@genspectrum/dashboard-components 0.1.2 → 0.1.4

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 (81) hide show
  1. package/README.md +1 -1
  2. package/custom-elements.json +453 -67
  3. package/dist/dashboard-components.js +778 -488
  4. package/dist/dashboard-components.js.map +1 -1
  5. package/dist/genspectrum-components.d.ts +277 -50
  6. package/dist/style.css +132 -139
  7. package/package.json +9 -5
  8. package/src/lapisApi/lapisApi.ts +1 -1
  9. package/src/preact/aggregatedData/__mockData__/aggregated.json +585 -0
  10. package/src/preact/aggregatedData/aggregate-table.tsx +32 -0
  11. package/src/preact/aggregatedData/aggregate.stories.tsx +53 -0
  12. package/src/preact/aggregatedData/aggregate.tsx +102 -0
  13. package/src/preact/components/ReferenceGenomesAwaiter.tsx +25 -0
  14. package/src/preact/components/csv-download-button.tsx +8 -2
  15. package/src/preact/components/headline.tsx +16 -4
  16. package/src/preact/components/min-max-range-slider.tsx +4 -4
  17. package/src/preact/components/percent-intput.tsx +2 -3
  18. package/src/preact/components/resize-container.tsx +23 -0
  19. package/src/preact/components/table.tsx +1 -0
  20. package/src/preact/components/tabs.stories.tsx +2 -2
  21. package/src/preact/components/tabs.tsx +47 -24
  22. package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +36 -4
  23. package/src/preact/dateRangeSelector/date-range-selector.tsx +57 -43
  24. package/src/preact/locationFilter/location-filter.tsx +2 -2
  25. package/src/preact/mutationComparison/getMutationComparisonTableData.spec.ts +5 -5
  26. package/src/preact/mutationComparison/getMutationComparisonTableData.ts +45 -10
  27. package/src/preact/mutationComparison/mutation-comparison-table.tsx +20 -22
  28. package/src/preact/mutationComparison/mutation-comparison-venn.tsx +6 -3
  29. package/src/preact/mutationComparison/mutation-comparison.stories.tsx +8 -1
  30. package/src/preact/mutationComparison/mutation-comparison.tsx +13 -4
  31. package/src/preact/mutationFilter/mutation-filter.stories.tsx +70 -31
  32. package/src/preact/mutationFilter/mutation-filter.tsx +62 -14
  33. package/src/preact/mutations/getInsertionsTableData.spec.ts +6 -4
  34. package/src/preact/mutations/getInsertionsTableData.ts +1 -1
  35. package/src/preact/mutations/getMutationsTableData.spec.ts +9 -19
  36. package/src/preact/mutations/getMutationsTableData.ts +1 -1
  37. package/src/preact/mutations/mutations-insertions-table.tsx +3 -1
  38. package/src/preact/mutations/mutations-table.tsx +3 -1
  39. package/src/preact/mutations/mutations.stories.tsx +8 -1
  40. package/src/preact/mutations/mutations.tsx +16 -5
  41. package/src/preact/prevalenceOverTime/prevalence-over-time-bar-chart.tsx +1 -0
  42. package/src/preact/prevalenceOverTime/prevalence-over-time-bubble-chart.tsx +1 -0
  43. package/src/preact/prevalenceOverTime/prevalence-over-time-line-chart.tsx +1 -0
  44. package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +4 -0
  45. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +17 -9
  46. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage-chart.tsx +8 -5
  47. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +12 -0
  48. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +13 -8
  49. package/src/preact/shared/sort/sortInsertions.spec.ts +11 -10
  50. package/src/preact/shared/sort/sortInsertions.ts +10 -17
  51. package/src/preact/shared/sort/sortSubstitutionsAndDeletions.spec.ts +19 -10
  52. package/src/preact/shared/sort/sortSubstitutionsAndDeletions.ts +45 -12
  53. package/src/preact/textInput/text-input.stories.tsx +22 -1
  54. package/src/preact/textInput/text-input.tsx +3 -1
  55. package/src/query/queryAggregateData.spec.ts +32 -0
  56. package/src/query/queryAggregateData.ts +25 -0
  57. package/src/utils/typeAssertions.spec.ts +31 -0
  58. package/src/utils/typeAssertions.ts +16 -0
  59. package/src/web-components/PreactLitAdapter.tsx +0 -1
  60. package/src/web-components/app.stories.ts +129 -0
  61. package/src/web-components/app.ts +27 -6
  62. package/src/web-components/display/aggregate-component.stories.ts +73 -0
  63. package/src/web-components/display/aggregate-component.tsx +58 -0
  64. package/src/web-components/display/index.ts +1 -0
  65. package/src/web-components/display/mutation-comparison-component.stories.ts +29 -11
  66. package/src/web-components/display/mutation-comparison-component.tsx +72 -4
  67. package/src/web-components/display/mutations-component.stories.ts +14 -13
  68. package/src/web-components/display/mutations-component.tsx +14 -1
  69. package/src/web-components/display/prevalence-over-time-component.stories.ts +20 -18
  70. package/src/web-components/display/prevalence-over-time-component.tsx +12 -0
  71. package/src/web-components/display/relative-growth-advantage-component.stories.ts +11 -10
  72. package/src/web-components/display/relative-growth-advantage-component.tsx +12 -0
  73. package/src/web-components/input/date-range-selector-component.stories.ts +35 -8
  74. package/src/web-components/input/date-range-selector-component.tsx +18 -5
  75. package/src/web-components/input/location-filter-component.stories.ts +17 -8
  76. package/src/web-components/input/location-filter-component.tsx +2 -6
  77. package/src/web-components/input/mutation-filter-component.stories.ts +20 -9
  78. package/src/web-components/input/mutation-filter-component.tsx +10 -2
  79. package/src/web-components/input/text-input-component.stories.ts +13 -4
  80. package/src/web-components/input/text-input-component.tsx +11 -2
  81. package/src/web-components/input/location-filter.mdx +0 -25
@@ -56,12 +56,44 @@
56
56
  },
57
57
  {
58
58
  "kind": "javascript-module",
59
- "path": "src/web-components/app.ts",
59
+ "path": "src/web-components/app.stories.ts",
60
60
  "declarations": [
61
+ {
62
+ "kind": "variable",
63
+ "name": "meta",
64
+ "type": {
65
+ "text": "Meta"
66
+ },
67
+ "default": "{\n title: 'Wrapper/App',\n component: 'gs-app',\n parameters: withComponentDocs({\n fetchMock: {},\n componentDocs: {\n tag: 'gs-app',\n opensShadowDom: false,\n expectsChildren: true,\n codeExample,\n },\n }),\n decorators: [withActions],\n tags: ['autodocs'],\n}"
68
+ },
69
+ {
70
+ "kind": "variable",
71
+ "name": "Default",
72
+ "type": {
73
+ "text": "StoryObj<{ lapis: string }>"
74
+ },
75
+ "default": "{\n ...Template,\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n\n await waitFor(() => {\n expect(canvas.getByText(LAPIS_URL)).toBeVisible();\n expect(canvas.getByText('\"name\": \"ORF1a\",', { exact: false })).toBeVisible();\n });\n },\n}"
76
+ },
77
+ {
78
+ "kind": "variable",
79
+ "name": "DelayFetchingReferenceGenome",
80
+ "type": {
81
+ "text": "StoryObj<{ lapis: string }>"
82
+ },
83
+ "default": "{\n ...Template,\n parameters: {\n fetchMock: {\n mocks: [\n {\n matcher: {\n name: 'referenceGenome',\n url: REFERENCE_GENOME_ENDPOINT,\n },\n response: {\n status: 200,\n body: referenceGenome,\n },\n options: {\n delay: 5000,\n },\n },\n ],\n },\n },\n}"
84
+ },
85
+ {
86
+ "kind": "variable",
87
+ "name": "FailsToFetchReferenceGenome",
88
+ "type": {
89
+ "text": "StoryObj<{ lapis: string }>"
90
+ },
91
+ "default": "{\n ...Template,\n args: {\n lapis: 'definitely-not-a-valid-url',\n },\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n\n await waitFor(() => {\n expect(canvas.getByText('Error')).toBeVisible();\n });\n },\n}"
92
+ },
61
93
  {
62
94
  "kind": "class",
63
95
  "description": "",
64
- "name": "App",
96
+ "name": "AppDisplay",
65
97
  "members": [
66
98
  {
67
99
  "kind": "field",
@@ -69,8 +101,7 @@
69
101
  "type": {
70
102
  "text": "string"
71
103
  },
72
- "default": "''",
73
- "attribute": "lapis"
104
+ "default": "''"
74
105
  },
75
106
  {
76
107
  "kind": "field",
@@ -79,16 +110,77 @@
79
110
  "text": "ReferenceGenome"
80
111
  },
81
112
  "default": "{\n nucleotideSequences: [],\n genes: [],\n }"
82
- },
113
+ }
114
+ ],
115
+ "superclass": {
116
+ "name": "LitElement",
117
+ "package": "lit"
118
+ },
119
+ "tagName": "gs-app-display",
120
+ "customElement": true
121
+ }
122
+ ],
123
+ "exports": [
124
+ {
125
+ "kind": "js",
126
+ "name": "default",
127
+ "declaration": {
128
+ "name": "meta",
129
+ "module": "src/web-components/app.stories.ts"
130
+ }
131
+ },
132
+ {
133
+ "kind": "js",
134
+ "name": "Default",
135
+ "declaration": {
136
+ "name": "Default",
137
+ "module": "src/web-components/app.stories.ts"
138
+ }
139
+ },
140
+ {
141
+ "kind": "js",
142
+ "name": "DelayFetchingReferenceGenome",
143
+ "declaration": {
144
+ "name": "DelayFetchingReferenceGenome",
145
+ "module": "src/web-components/app.stories.ts"
146
+ }
147
+ },
148
+ {
149
+ "kind": "js",
150
+ "name": "FailsToFetchReferenceGenome",
151
+ "declaration": {
152
+ "name": "FailsToFetchReferenceGenome",
153
+ "module": "src/web-components/app.stories.ts"
154
+ }
155
+ },
156
+ {
157
+ "kind": "custom-element-definition",
158
+ "name": "gs-app-display",
159
+ "declaration": {
160
+ "name": "AppDisplay",
161
+ "module": "src/web-components/app.stories.ts"
162
+ }
163
+ }
164
+ ]
165
+ },
166
+ {
167
+ "kind": "javascript-module",
168
+ "path": "src/web-components/app.ts",
169
+ "declarations": [
170
+ {
171
+ "kind": "class",
172
+ "description": "## Context\n\nThis component provides the main application context.\nAll other `gs-*` components must be (possibly nested) children of this component.\nIt makes use of the [Lit Context](https://lit.dev/docs/data/context/) to\n- provide the URL to the LAPIS instance to all its children\n- fetch the reference genomes from LAPIS and provide it to all its children\n\nThis will show an error message if the reference genome cannot be fetched\n(e.g., due to an invalid LAPIS URL).\n\n## Shadow DOM\n\nThis component does __not__ use a shadow DOM. Children of this component will be rendered directly in the light DOM.",
173
+ "name": "App",
174
+ "members": [
83
175
  {
84
176
  "kind": "field",
85
- "name": "updateReferenceGenome",
86
- "privacy": "private",
87
- "default": "new Task(this, {\n task: async () => {\n this.referenceGenome = await fetchReferenceGenome(this.lapis);\n },\n args: () => [this.lapis],\n })"
88
- },
89
- {
90
- "kind": "method",
91
- "name": "createRenderRoot"
177
+ "name": "lapis",
178
+ "type": {
179
+ "text": "string"
180
+ },
181
+ "default": "''",
182
+ "description": "The URL of the LAPIS instance that all children of this component will use.",
183
+ "attribute": "lapis"
92
184
  }
93
185
  ],
94
186
  "attributes": [
@@ -98,6 +190,7 @@
98
190
  "text": "string"
99
191
  },
100
192
  "default": "''",
193
+ "description": "The URL of the LAPIS instance that all children of this component will use.",
101
194
  "fieldName": "lapis"
102
195
  }
103
196
  ],
@@ -128,6 +221,161 @@
128
221
  }
129
222
  ]
130
223
  },
224
+ {
225
+ "kind": "javascript-module",
226
+ "path": "src/web-components/display/aggregate-component.stories.ts",
227
+ "declarations": [
228
+ {
229
+ "kind": "variable",
230
+ "name": "meta",
231
+ "type": {
232
+ "text": "Meta<AggregateProps>"
233
+ },
234
+ "default": "{\n title: 'Visualization/Aggregate',\n component: 'gs-aggregate-component',\n argTypes: {\n fields: [{ control: 'object' }],\n views: {\n options: ['table'],\n control: { type: 'check' },\n },\n size: [{ control: 'object' }],\n },\n parameters: withComponentDocs({\n fetchMock: {\n mocks: [\n {\n matcher: {\n name: 'aggregatedData',\n url: AGGREGATED_ENDPOINT,\n body: {\n fields: ['division', 'host'],\n country: 'USA',\n },\n },\n response: {\n status: 200,\n body: aggregatedData,\n },\n },\n ],\n },\n componentDocs: {\n tag: 'gs-aggregate-component',\n opensShadowDom: true,\n expectsChildren: false,\n codeExample: `<gs-aggregate-component fields='[\"division\", \"host\"]' filter='{\"country\": \"USA\"}' views='[\"table\"]'></gs-aggregate-component>`,\n },\n }),\n tags: ['autodocs'],\n}"
235
+ },
236
+ {
237
+ "kind": "variable",
238
+ "name": "Table",
239
+ "type": {
240
+ "text": "StoryObj<AggregateProps>"
241
+ },
242
+ "default": "{\n render: (args) => html`\n <gs-app lapis=\"${LAPIS_URL}\">\n <gs-aggregate-component\n .fields=${args.fields}\n .filter=${args.filter}\n .views=${args.views}\n .size=${args.size}\n ></gs-aggregate-component>\n </gs-app>\n `,\n args: {\n fields: ['division', 'host'],\n views: ['table'],\n filter: {\n country: 'USA',\n },\n size: { width: '100%', height: '700px' },\n },\n}"
243
+ }
244
+ ],
245
+ "exports": [
246
+ {
247
+ "kind": "js",
248
+ "name": "default",
249
+ "declaration": {
250
+ "name": "meta",
251
+ "module": "src/web-components/display/aggregate-component.stories.ts"
252
+ }
253
+ },
254
+ {
255
+ "kind": "js",
256
+ "name": "Table",
257
+ "declaration": {
258
+ "name": "Table",
259
+ "module": "src/web-components/display/aggregate-component.stories.ts"
260
+ }
261
+ }
262
+ ]
263
+ },
264
+ {
265
+ "kind": "javascript-module",
266
+ "path": "src/web-components/display/aggregate-component.tsx",
267
+ "declarations": [
268
+ {
269
+ "kind": "class",
270
+ "description": "## Context\n\nThis component displays aggregated data, which can provide an overview of the underlying data.\n\nIt expects a list of fields to aggregate by and a filter to apply to the data.",
271
+ "name": "AggregateComponent",
272
+ "members": [
273
+ {
274
+ "kind": "field",
275
+ "name": "fields",
276
+ "type": {
277
+ "text": "string[]"
278
+ },
279
+ "default": "[]",
280
+ "description": "The fields to aggregate by.",
281
+ "attribute": "fields"
282
+ },
283
+ {
284
+ "kind": "field",
285
+ "name": "views",
286
+ "type": {
287
+ "text": "View[]"
288
+ },
289
+ "default": "['table']",
290
+ "description": "The views are used to display the aggregated data.\nIn the table view, the data is presented in a table format where each field is a column,\nalong with the aggregated value and its proportion.\nThe proportion represents the ratio of the aggregated value to the total count of the data\n(considering the applied filter).",
291
+ "attribute": "views"
292
+ },
293
+ {
294
+ "kind": "field",
295
+ "name": "filter",
296
+ "type": {
297
+ "text": "LapisFilter"
298
+ },
299
+ "default": "{}",
300
+ "description": "The filter to apply to the data.",
301
+ "attribute": "filter"
302
+ },
303
+ {
304
+ "kind": "field",
305
+ "name": "size",
306
+ "type": {
307
+ "text": "{ width?: string; height?: string } | undefined"
308
+ },
309
+ "default": "undefined",
310
+ "description": "The size of the component.\n\nIf not set, the component will take the full width of its container with height 700px.\n\nThe width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.\nIf the unit is %, the size will be relative to the container of the component.",
311
+ "attribute": "size"
312
+ }
313
+ ],
314
+ "attributes": [
315
+ {
316
+ "name": "fields",
317
+ "type": {
318
+ "text": "string[]"
319
+ },
320
+ "default": "[]",
321
+ "description": "The fields to aggregate by.",
322
+ "fieldName": "fields"
323
+ },
324
+ {
325
+ "name": "views",
326
+ "type": {
327
+ "text": "View[]"
328
+ },
329
+ "default": "['table']",
330
+ "description": "The views are used to display the aggregated data.\nIn the table view, the data is presented in a table format where each field is a column,\nalong with the aggregated value and its proportion.\nThe proportion represents the ratio of the aggregated value to the total count of the data\n(considering the applied filter).",
331
+ "fieldName": "views"
332
+ },
333
+ {
334
+ "name": "filter",
335
+ "type": {
336
+ "text": "LapisFilter"
337
+ },
338
+ "default": "{}",
339
+ "description": "The filter to apply to the data.",
340
+ "fieldName": "filter"
341
+ },
342
+ {
343
+ "name": "size",
344
+ "type": {
345
+ "text": "{ width?: string; height?: string } | undefined"
346
+ },
347
+ "default": "undefined",
348
+ "description": "The size of the component.\n\nIf not set, the component will take the full width of its container with height 700px.\n\nThe width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.\nIf the unit is %, the size will be relative to the container of the component.",
349
+ "fieldName": "size"
350
+ }
351
+ ],
352
+ "superclass": {
353
+ "name": "PreactLitAdapterWithGridJsStyles",
354
+ "module": "/src/web-components/PreactLitAdapterWithGridJsStyles"
355
+ },
356
+ "tagName": "gs-aggregate-component",
357
+ "customElement": true
358
+ }
359
+ ],
360
+ "exports": [
361
+ {
362
+ "kind": "js",
363
+ "name": "AggregateComponent",
364
+ "declaration": {
365
+ "name": "AggregateComponent",
366
+ "module": "src/web-components/display/aggregate-component.tsx"
367
+ }
368
+ },
369
+ {
370
+ "kind": "custom-element-definition",
371
+ "name": "gs-aggregate-component",
372
+ "declaration": {
373
+ "name": "AggregateComponent",
374
+ "module": "src/web-components/display/aggregate-component.tsx"
375
+ }
376
+ }
377
+ ]
378
+ },
131
379
  {
132
380
  "kind": "javascript-module",
133
381
  "path": "src/web-components/display/index.ts",
@@ -164,6 +412,14 @@
164
412
  "name": "RelativeGrowthAdvantageComponent",
165
413
  "module": "./relative-growth-advantage-component"
166
414
  }
415
+ },
416
+ {
417
+ "kind": "js",
418
+ "name": "AggregateComponent",
419
+ "declaration": {
420
+ "name": "AggregateComponent",
421
+ "module": "./aggregate-component"
422
+ }
167
423
  }
168
424
  ]
169
425
  },
@@ -177,7 +433,7 @@
177
433
  "type": {
178
434
  "text": "Meta<MutationComparisonProps>"
179
435
  },
180
- "default": "{\n title: 'Visualization/Mutation comparison',\n component: 'gs-mutation-comparison-component',\n argTypes: {\n variants: { control: 'object' },\n sequenceType: {\n options: ['nucleotide', 'amino acid'],\n control: { type: 'radio' },\n },\n views: {\n options: ['table', 'venn'],\n control: { type: 'check' },\n },\n },\n}"
436
+ "default": "{\n title: 'Visualization/Mutation comparison',\n component: 'gs-mutation-comparison-component',\n argTypes: {\n variants: { control: 'object' },\n sequenceType: {\n options: ['nucleotide', 'amino acid'],\n control: { type: 'radio' },\n },\n views: {\n options: ['table', 'venn'],\n control: { type: 'check' },\n },\n size: { control: 'object' },\n },\n parameters: withComponentDocs({\n componentDocs: {\n tag: 'gs-mutation-comparison-component',\n opensShadowDom: true,\n expectsChildren: false,\n codeExample,\n },\n }),\n tags: ['autodocs'],\n}"
181
437
  },
182
438
  {
183
439
  "kind": "variable",
@@ -185,7 +441,7 @@
185
441
  "type": {
186
442
  "text": "StoryObj<MutationComparisonProps>"
187
443
  },
188
- "default": "{\n ...Template,\n args: {\n variants: [\n {\n displayName: 'Some variant',\n lapisFilter: { country: 'Switzerland', pangoLineage: 'B.1.1.7', dateTo },\n },\n {\n displayName: 'Other variant',\n lapisFilter: {\n country: 'Switzerland',\n pangoLineage: 'B.1.1.7',\n dateFrom,\n dateTo,\n },\n },\n ],\n sequenceType: 'nucleotide',\n views: ['table', 'venn'],\n },\n parameters: {\n fetchMock: {\n mocks: [\n {\n matcher: {\n name: 'nucleotideMutationsSomeVariant',\n url: NUCLEOTIDE_MUTATIONS_ENDPOINT,\n body: {\n country: 'Switzerland',\n pangoLineage: 'B.1.1.7',\n dateTo,\n minProportion: 0,\n },\n },\n response: {\n status: 200,\n body: nucleotideMutationsSomeVariant,\n },\n },\n {\n matcher: {\n name: 'nucleotideMutationsOtherVariant',\n url: NUCLEOTIDE_MUTATIONS_ENDPOINT,\n body: {\n country: 'Switzerland',\n pangoLineage: 'B.1.1.7',\n dateFrom,\n dateTo,\n minProportion: 0,\n },\n },\n response: {\n status: 200,\n body: nucleotideMutationsOtherVariant,\n },\n },\n ],\n },\n },\n play: async ({ canvasElement, step }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-mutation-comparison-component');\n\n await step('Min and max proportions should be 50% and 100%', async () => {\n const minInput = () => canvas.getAllByLabelText('%')[0];\n const maxInput = () => canvas.getAllByLabelText('%')[1];\n\n await waitFor(() => expect(minInput()).toHaveValue(50));\n await waitFor(() => expect(maxInput()).toHaveValue(100));\n });\n },\n}"
444
+ "default": "{\n ...Template,\n args: {\n variants: [\n {\n displayName: 'Some variant',\n lapisFilter: { country: 'Switzerland', pangoLineage: 'B.1.1.7', dateTo },\n },\n {\n displayName: 'Other variant',\n lapisFilter: {\n country: 'Switzerland',\n pangoLineage: 'B.1.1.7',\n dateFrom,\n dateTo,\n },\n },\n ],\n sequenceType: 'nucleotide',\n views: ['table', 'venn'],\n size: { width: '100%', height: '700px' },\n },\n parameters: {\n fetchMock: {\n mocks: [\n {\n matcher: {\n name: 'nucleotideMutationsSomeVariant',\n url: NUCLEOTIDE_MUTATIONS_ENDPOINT,\n body: {\n country: 'Switzerland',\n pangoLineage: 'B.1.1.7',\n dateTo,\n minProportion: 0,\n },\n },\n response: {\n status: 200,\n body: nucleotideMutationsSomeVariant,\n },\n },\n {\n matcher: {\n name: 'nucleotideMutationsOtherVariant',\n url: NUCLEOTIDE_MUTATIONS_ENDPOINT,\n body: {\n country: 'Switzerland',\n pangoLineage: 'B.1.1.7',\n dateFrom,\n dateTo,\n minProportion: 0,\n },\n },\n response: {\n status: 200,\n body: nucleotideMutationsOtherVariant,\n },\n },\n ],\n },\n },\n play: async ({ canvasElement, step }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-mutation-comparison-component');\n\n await step('Min and max proportions should be 50% and 100%', async () => {\n const minInput = () => canvas.getAllByLabelText('%')[0];\n const maxInput = () => canvas.getAllByLabelText('%')[1];\n\n await waitFor(() => expect(minInput()).toHaveValue(50));\n await waitFor(() => expect(maxInput()).toHaveValue(100));\n });\n },\n}"
189
445
  },
190
446
  {
191
447
  "kind": "variable",
@@ -193,7 +449,7 @@
193
449
  "type": {
194
450
  "text": "StoryObj<MutationComparisonProps>"
195
451
  },
196
- "default": "{\n ...Default,\n play: async ({ canvasElement, step }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-mutation-comparison-component');\n\n await step('Switch to Venn diagram view', async () => {\n await waitFor(() => expect(canvas.getByLabelText('Venn', { selector: 'input' })).toBeInTheDocument());\n\n await fireEvent.click(canvas.getByLabelText('Venn', { selector: 'input' }));\n\n await waitFor(() =>\n expect(\n canvas.getByText('You have no elements selected. Click in the venn diagram to select.'),\n ).toBeVisible(),\n );\n });\n },\n}"
452
+ "default": "{\n ...Default,\n play: async ({ canvasElement, step }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-mutation-comparison-component');\n\n await step('Switch to Venn diagram view', async () => {\n await waitFor(() => expect(canvas.getByRole('button', { name: 'Venn' })).toBeInTheDocument());\n\n await fireEvent.click(canvas.getByRole('button', { name: 'Venn' }));\n\n await waitFor(() =>\n expect(\n canvas.getByText('You have no elements selected. Click in the venn diagram to select.'),\n ).toBeVisible(),\n );\n });\n },\n}"
197
453
  }
198
454
  ],
199
455
  "exports": [
@@ -229,61 +485,86 @@
229
485
  "declarations": [
230
486
  {
231
487
  "kind": "class",
232
- "description": "",
488
+ "description": "This component allows to compare mutations between different variants.\nA variant is defined by its LAPIS filter.\n\nIt only shows substitutions and deletions, it does not show insertions.\n\n## Views\n\n### Table View\n\nThe table view shows mutations\nand the proportions with which the mutation occurs in the respective variant.\nIt only shows mutations that are present in at least one of the variants\nand where the proportion is within the selected proportion interval for at least one variant.\n\n### Venn View\n\nThe Venn view shows the overlap of mutations between the variants in a Venn diagram.\nA variant is considered to have a certain mutation,\nif the proportion of the mutation in the variant is within the selected proportion interval.\nThus, changing the proportion interval may change a mutations from being \"common\" between variant\nto being \"for one variant only\".",
233
489
  "name": "MutationComparisonComponent",
234
490
  "members": [
235
491
  {
236
492
  "kind": "field",
237
493
  "name": "variants",
238
494
  "type": {
239
- "text": "MutationComparisonVariant[]"
495
+ "text": "{\n lapisFilter: Record<string, string | number | null | boolean>;\n displayName: string;\n }[]"
240
496
  },
241
497
  "default": "[]",
498
+ "description": "An array of variants to compare.\n\nThe `lapisFilter` will be sent as is to LAPIS to filter the mutation data.\nIt must be a valid LAPIS filter object.\n\nThe `displayName` will be used as the label for the variant in the views.\nIt should be human-readable.",
242
499
  "attribute": "variants"
243
500
  },
244
501
  {
245
502
  "kind": "field",
246
503
  "name": "sequenceType",
247
504
  "type": {
248
- "text": "SequenceType"
505
+ "text": "'nucleotide' | 'amino acid'"
249
506
  },
250
507
  "default": "'nucleotide'",
508
+ "description": "The type of the sequence for which the mutations should be shown.",
251
509
  "attribute": "sequenceType"
252
510
  },
253
511
  {
254
512
  "kind": "field",
255
513
  "name": "views",
256
514
  "type": {
257
- "text": "View[]"
515
+ "text": "('table' | 'venn')[]"
258
516
  },
259
517
  "default": "['table']",
518
+ "description": "A list of tabs with views that this component should provide.",
260
519
  "attribute": "views"
520
+ },
521
+ {
522
+ "kind": "field",
523
+ "name": "size",
524
+ "type": {
525
+ "text": "{ width?: string; height?: string } | undefined"
526
+ },
527
+ "default": "undefined",
528
+ "description": "The size of the component.\n\nIf not set, the component will take the full width of its container with height 700px.\n\nThe width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.\nIf the unit is %, the size will be relative to the container of the component.",
529
+ "attribute": "size"
261
530
  }
262
531
  ],
263
532
  "attributes": [
264
533
  {
265
534
  "name": "variants",
266
535
  "type": {
267
- "text": "MutationComparisonVariant[]"
536
+ "text": "{\n lapisFilter: Record<string, string | number | null | boolean>;\n displayName: string;\n }[]"
268
537
  },
269
538
  "default": "[]",
539
+ "description": "An array of variants to compare.\n\nThe `lapisFilter` will be sent as is to LAPIS to filter the mutation data.\nIt must be a valid LAPIS filter object.\n\nThe `displayName` will be used as the label for the variant in the views.\nIt should be human-readable.",
270
540
  "fieldName": "variants"
271
541
  },
272
542
  {
273
543
  "name": "sequenceType",
274
544
  "type": {
275
- "text": "SequenceType"
545
+ "text": "'nucleotide' | 'amino acid'"
276
546
  },
277
547
  "default": "'nucleotide'",
548
+ "description": "The type of the sequence for which the mutations should be shown.",
278
549
  "fieldName": "sequenceType"
279
550
  },
280
551
  {
281
552
  "name": "views",
282
553
  "type": {
283
- "text": "View[]"
554
+ "text": "('table' | 'venn')[]"
284
555
  },
285
556
  "default": "['table']",
557
+ "description": "A list of tabs with views that this component should provide.",
286
558
  "fieldName": "views"
559
+ },
560
+ {
561
+ "name": "size",
562
+ "type": {
563
+ "text": "{ width?: string; height?: string } | undefined"
564
+ },
565
+ "default": "undefined",
566
+ "description": "The size of the component.\n\nIf not set, the component will take the full width of its container with height 700px.\n\nThe width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.\nIf the unit is %, the size will be relative to the container of the component.",
567
+ "fieldName": "size"
287
568
  }
288
569
  ],
289
570
  "superclass": {
@@ -323,7 +604,7 @@
323
604
  "type": {
324
605
  "text": "Meta<MutationsProps>"
325
606
  },
326
- "default": "{\n title: 'Visualization/Mutations',\n component: 'gs-mutations',\n argTypes: {\n variant: { control: 'object' },\n sequenceType: {\n options: ['nucleotide', 'amino acid'],\n control: { type: 'radio' },\n },\n views: {\n options: ['table', 'grid', 'insertions'],\n control: { type: 'check' },\n },\n },\n}"
607
+ "default": "{\n title: 'Visualization/Mutations',\n component: 'gs-mutations',\n argTypes: {\n variant: { control: 'object' },\n sequenceType: {\n options: ['nucleotide', 'amino acid'],\n control: { type: 'radio' },\n },\n views: {\n options: ['table', 'grid', 'insertions'],\n control: { type: 'check' },\n },\n size: { control: 'object' },\n },\n}"
327
608
  },
328
609
  {
329
610
  "kind": "variable",
@@ -331,7 +612,7 @@
331
612
  "type": {
332
613
  "text": "StoryObj<MutationsProps>"
333
614
  },
334
- "default": "{\n ...Template,\n args: {\n variant: { country: 'Switzerland', pangoLineage: 'B.1.1.7', dateTo: '2022-01-01' },\n sequenceType: 'nucleotide',\n views: ['grid', 'table', 'insertions'],\n },\n parameters: {\n fetchMock: {\n mocks: [\n {\n matcher: {\n name: 'nucleotideMutations',\n url: NUCLEOTIDE_MUTATIONS_ENDPOINT,\n body: {\n country: 'Switzerland',\n pangoLineage: 'B.1.1.7',\n dateTo: '2022-01-01',\n minProportion: 0,\n },\n },\n response: {\n status: 200,\n body: nucleotideMutations,\n },\n },\n {\n matcher: {\n name: 'nucleotideInsertions',\n url: NUCLEOTIDE_INSERTIONS_ENDPOINT,\n body: { country: 'Switzerland', pangoLineage: 'B.1.1.7', dateTo: '2022-01-01' },\n },\n response: {\n status: 200,\n body: nucleotideInsertions,\n },\n },\n ],\n },\n },\n}"
615
+ "default": "{\n ...Template,\n args: {\n variant: { country: 'Switzerland', pangoLineage: 'B.1.1.7', dateTo: '2022-01-01' },\n sequenceType: 'nucleotide',\n views: ['grid', 'table', 'insertions'],\n size: { width: '100%', height: '700px' },\n },\n parameters: {\n fetchMock: {\n mocks: [\n {\n matcher: {\n name: 'nucleotideMutations',\n url: NUCLEOTIDE_MUTATIONS_ENDPOINT,\n body: {\n country: 'Switzerland',\n pangoLineage: 'B.1.1.7',\n dateTo: '2022-01-01',\n minProportion: 0,\n },\n },\n response: {\n status: 200,\n body: nucleotideMutations,\n },\n },\n {\n matcher: {\n name: 'nucleotideInsertions',\n url: NUCLEOTIDE_INSERTIONS_ENDPOINT,\n body: { country: 'Switzerland', pangoLineage: 'B.1.1.7', dateTo: '2022-01-01' },\n },\n response: {\n status: 200,\n body: nucleotideInsertions,\n },\n },\n ],\n },\n },\n}"
335
616
  },
336
617
  {
337
618
  "kind": "variable",
@@ -339,7 +620,7 @@
339
620
  "type": {
340
621
  "text": "StoryObj<MutationsProps>"
341
622
  },
342
- "default": "{\n ...Default,\n play: async ({ canvasElement }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-mutations-component');\n\n await waitFor(() => expect(canvas.getByLabelText('Table', { selector: 'input' })).toBeInTheDocument());\n\n await fireEvent.click(canvas.getByLabelText('Table', { selector: 'input' }));\n },\n}"
623
+ "default": "{\n ...Default,\n play: async ({ canvasElement }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-mutations-component');\n\n await waitFor(() => expect(canvas.getByRole('button', { name: 'Table' })).toBeInTheDocument());\n\n await fireEvent.click(canvas.getByRole('button', { name: 'Table' }));\n },\n}"
343
624
  },
344
625
  {
345
626
  "kind": "variable",
@@ -347,7 +628,7 @@
347
628
  "type": {
348
629
  "text": "StoryObj<MutationsProps>"
349
630
  },
350
- "default": "{\n ...Default,\n play: async ({ canvasElement }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-mutations-component');\n\n await waitFor(() => expect(canvas.getByLabelText('Insertions', { selector: 'input' })).toBeInTheDocument());\n\n await fireEvent.click(canvas.getByLabelText('Insertions', { selector: 'input' }));\n },\n}"
631
+ "default": "{\n ...Default,\n play: async ({ canvasElement }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-mutations-component');\n\n await waitFor(() => expect(canvas.getByRole('button', { name: 'Insertions' })).toBeInTheDocument());\n\n await fireEvent.click(canvas.getByRole('button', { name: 'Insertions' }));\n },\n}"
351
632
  }
352
633
  ],
353
634
  "exports": [
@@ -420,6 +701,16 @@
420
701
  },
421
702
  "default": "['table', 'grid']",
422
703
  "attribute": "views"
704
+ },
705
+ {
706
+ "kind": "field",
707
+ "name": "size",
708
+ "type": {
709
+ "text": "{ width?: string; height?: string } | undefined"
710
+ },
711
+ "default": "undefined",
712
+ "description": "The size of the component.\n\nIf not set, the component will take the full width of its container with height 700px.\n\nThe width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.\nIf the unit is %, the size will be relative to the container of the component.",
713
+ "attribute": "size"
423
714
  }
424
715
  ],
425
716
  "attributes": [
@@ -446,6 +737,15 @@
446
737
  },
447
738
  "default": "['table', 'grid']",
448
739
  "fieldName": "views"
740
+ },
741
+ {
742
+ "name": "size",
743
+ "type": {
744
+ "text": "{ width?: string; height?: string } | undefined"
745
+ },
746
+ "default": "undefined",
747
+ "description": "The size of the component.\n\nIf not set, the component will take the full width of its container with height 700px.\n\nThe width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.\nIf the unit is %, the size will be relative to the container of the component.",
748
+ "fieldName": "size"
449
749
  }
450
750
  ],
451
751
  "superclass": {
@@ -485,7 +785,7 @@
485
785
  "type": {
486
786
  "text": "Meta<PrevalenceOverTimeProps>"
487
787
  },
488
- "default": "{\n title: 'Visualization/Prevalence over time',\n component: 'gs-prevalence-over-time',\n argTypes: {\n numerator: { control: 'object' },\n denominator: { control: 'object' },\n granularity: {\n options: ['day', 'week', 'month', 'year'],\n control: { type: 'radio' },\n },\n smoothingWindow: { control: 'number' },\n views: {\n options: ['bar', 'line', 'bubble', 'table'],\n control: { type: 'check' },\n },\n confidenceIntervalMethods: {\n options: ['wilson'],\n control: { type: 'check' },\n },\n },\n}"
788
+ "default": "{\n title: 'Visualization/Prevalence over time',\n component: 'gs-prevalence-over-time',\n argTypes: {\n numerator: { control: 'object' },\n denominator: { control: 'object' },\n granularity: {\n options: ['day', 'week', 'month', 'year'],\n control: { type: 'radio' },\n },\n smoothingWindow: { control: 'number' },\n views: {\n options: ['bar', 'line', 'bubble', 'table'],\n control: { type: 'check' },\n },\n confidenceIntervalMethods: {\n options: ['wilson'],\n control: { type: 'check' },\n },\n size: [{ control: 'object' }],\n },\n}"
489
789
  },
490
790
  {
491
791
  "kind": "variable",
@@ -493,7 +793,7 @@
493
793
  "type": {
494
794
  "text": "StoryObj<PrevalenceOverTimeProps>"
495
795
  },
496
- "default": "{\n ...Template,\n args: {\n numerator: [\n { displayName: 'EG', country: 'USA', pangoLineage: 'EG*', dateFrom: '2023-01-01' },\n { displayName: 'JN.1', country: 'USA', pangoLineage: 'JN.1*', dateFrom: '2023-01-01' },\n ],\n denominator: { country: 'USA', dateFrom: '2023-01-01', displayName: 'All' },\n granularity: 'month',\n smoothingWindow: 0,\n views: ['bar', 'line', 'bubble', 'table'],\n confidenceIntervalMethods: ['wilson'],\n },\n parameters: {\n fetchMock: {\n mocks: [\n {\n matcher: {\n name: 'numeratorEG',\n url: AGGREGATED_ENDPOINT,\n body: {\n country: 'USA',\n pangoLineage: 'EG*',\n dateFrom: '2023-01-01',\n fields: ['date'],\n },\n },\n response: {\n status: 200,\n body: numeratorEG,\n },\n },\n {\n matcher: {\n name: 'numeratorJN1',\n url: AGGREGATED_ENDPOINT,\n body: {\n country: 'USA',\n pangoLineage: 'JN.1*',\n dateFrom: '2023-01-01',\n fields: ['date'],\n },\n },\n response: {\n status: 200,\n body: numeratorJN1,\n },\n },\n {\n matcher: {\n name: 'denominator',\n url: AGGREGATED_ENDPOINT,\n body: {\n country: 'USA',\n dateFrom: '2023-01-01',\n fields: ['date'],\n },\n },\n response: {\n status: 200,\n body: denominator,\n },\n },\n ],\n },\n },\n}"
796
+ "default": "{\n ...Template,\n args: {\n numerator: [\n { displayName: 'EG', country: 'USA', pangoLineage: 'EG*', dateFrom: '2023-01-01' },\n { displayName: 'JN.1', country: 'USA', pangoLineage: 'JN.1*', dateFrom: '2023-01-01' },\n ],\n denominator: { country: 'USA', dateFrom: '2023-01-01', displayName: 'All' },\n granularity: 'month',\n smoothingWindow: 0,\n views: ['bar', 'line', 'bubble', 'table'],\n confidenceIntervalMethods: ['wilson'],\n size: { width: '100%', height: '700px' },\n },\n parameters: {\n fetchMock: {\n mocks: [\n {\n matcher: {\n name: 'numeratorEG',\n url: AGGREGATED_ENDPOINT,\n body: {\n country: 'USA',\n pangoLineage: 'EG*',\n dateFrom: '2023-01-01',\n fields: ['date'],\n },\n },\n response: {\n status: 200,\n body: numeratorEG,\n },\n },\n {\n matcher: {\n name: 'numeratorJN1',\n url: AGGREGATED_ENDPOINT,\n body: {\n country: 'USA',\n pangoLineage: 'JN.1*',\n dateFrom: '2023-01-01',\n fields: ['date'],\n },\n },\n response: {\n status: 200,\n body: numeratorJN1,\n },\n },\n {\n matcher: {\n name: 'denominator',\n url: AGGREGATED_ENDPOINT,\n body: {\n country: 'USA',\n dateFrom: '2023-01-01',\n fields: ['date'],\n },\n },\n response: {\n status: 200,\n body: denominator,\n },\n },\n ],\n },\n },\n}"
497
797
  },
498
798
  {
499
799
  "kind": "variable",
@@ -501,7 +801,7 @@
501
801
  "type": {
502
802
  "text": "StoryObj<PrevalenceOverTimeProps>"
503
803
  },
504
- "default": "{\n ...Template,\n args: {\n numerator: { displayName: 'EG', country: 'USA', pangoLineage: 'BA.2.86*', dateFrom: '2023-10-01' },\n denominator: { country: 'USA', dateFrom: '2023-10-01', displayName: 'All' },\n granularity: 'day',\n smoothingWindow: 7,\n views: ['bar', 'line', 'bubble', 'table'],\n confidenceIntervalMethods: ['wilson'],\n },\n parameters: {\n fetchMock: {\n mocks: [\n {\n matcher: {\n name: 'numeratorOneVariant',\n url: AGGREGATED_ENDPOINT,\n body: {\n country: 'USA',\n pangoLineage: 'BA.2.86*',\n dateFrom: '2023-10-01',\n fields: ['date'],\n },\n },\n response: {\n status: 200,\n body: numeratorOneVariant,\n },\n },\n {\n matcher: {\n name: 'denominatorOneVariant',\n url: AGGREGATED_ENDPOINT,\n body: {\n country: 'USA',\n dateFrom: '2023-10-01',\n fields: ['date'],\n },\n },\n response: {\n status: 200,\n body: denominatorOneVariant,\n },\n },\n ],\n },\n },\n}"
804
+ "default": "{\n ...Template,\n args: {\n numerator: { displayName: 'EG', country: 'USA', pangoLineage: 'BA.2.86*', dateFrom: '2023-10-01' },\n denominator: { country: 'USA', dateFrom: '2023-10-01', displayName: 'All' },\n granularity: 'day',\n smoothingWindow: 7,\n views: ['bar', 'line', 'bubble', 'table'],\n confidenceIntervalMethods: ['wilson'],\n size: { width: '100%', height: '700px' },\n },\n parameters: {\n fetchMock: {\n mocks: [\n {\n matcher: {\n name: 'numeratorOneVariant',\n url: AGGREGATED_ENDPOINT,\n body: {\n country: 'USA',\n pangoLineage: 'BA.2.86*',\n dateFrom: '2023-10-01',\n fields: ['date'],\n },\n },\n response: {\n status: 200,\n body: numeratorOneVariant,\n },\n },\n {\n matcher: {\n name: 'denominatorOneVariant',\n url: AGGREGATED_ENDPOINT,\n body: {\n country: 'USA',\n dateFrom: '2023-10-01',\n fields: ['date'],\n },\n },\n response: {\n status: 200,\n body: denominatorOneVariant,\n },\n },\n ],\n },\n },\n}"
505
805
  },
506
806
  {
507
807
  "kind": "variable",
@@ -509,7 +809,7 @@
509
809
  "type": {
510
810
  "text": "StoryObj<PrevalenceOverTimeProps>"
511
811
  },
512
- "default": "{\n ...OneVariant,\n play: async ({ canvasElement }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');\n\n await waitFor(() => expect(canvas.getByLabelText('Line', { selector: 'input' })).toBeInTheDocument());\n\n await fireEvent.click(canvas.getByLabelText('Line', { selector: 'input' }));\n },\n}"
812
+ "default": "{\n ...OneVariant,\n play: async ({ canvasElement }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');\n\n await waitFor(() => expect(canvas.getByRole('button', { name: 'Line' })).toBeInTheDocument());\n\n await fireEvent.click(canvas.getByRole('button', { name: 'Line' }));\n },\n}"
513
813
  },
514
814
  {
515
815
  "kind": "variable",
@@ -517,7 +817,7 @@
517
817
  "type": {
518
818
  "text": "StoryObj<PrevalenceOverTimeProps>"
519
819
  },
520
- "default": "{\n ...OneVariant,\n play: async ({ canvasElement }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');\n\n await waitFor(() => expect(canvas.getByLabelText('Bubble', { selector: 'input' })).toBeInTheDocument());\n\n await fireEvent.click(canvas.getByLabelText('Bubble', { selector: 'input' }));\n },\n}"
820
+ "default": "{\n ...OneVariant,\n play: async ({ canvasElement }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');\n\n await waitFor(() => expect(canvas.getByRole('button', { name: 'Bubble' })).toBeInTheDocument());\n\n await fireEvent.click(canvas.getByRole('button', { name: 'Bubble' }));\n },\n}"
521
821
  },
522
822
  {
523
823
  "kind": "variable",
@@ -525,7 +825,7 @@
525
825
  "type": {
526
826
  "text": "StoryObj<PrevalenceOverTimeProps>"
527
827
  },
528
- "default": "{\n ...OneVariant,\n play: async ({ canvasElement }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');\n\n await waitFor(() => expect(canvas.getByLabelText('Table', { selector: 'input' })).toBeInTheDocument());\n\n await fireEvent.click(canvas.getByLabelText('Table', { selector: 'input' }));\n },\n}"
828
+ "default": "{\n ...OneVariant,\n play: async ({ canvasElement }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');\n\n await waitFor(() => expect(canvas.getByRole('button', { name: 'Table' })).toBeInTheDocument());\n\n await fireEvent.click(canvas.getByRole('button', { name: 'Table' }));\n },\n}"
529
829
  }
530
830
  ],
531
831
  "exports": [
@@ -641,6 +941,16 @@
641
941
  },
642
942
  "default": "['wilson']",
643
943
  "attribute": "confidenceIntervalMethods"
944
+ },
945
+ {
946
+ "kind": "field",
947
+ "name": "size",
948
+ "type": {
949
+ "text": "{ width?: string; height?: string } | undefined"
950
+ },
951
+ "default": "undefined",
952
+ "description": "The size of the component.\n\nIf not set, the component will take the full width of its container with height 700px.\n\nThe width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.\nIf the unit is %, the size will be relative to the container of the component.",
953
+ "attribute": "size"
644
954
  }
645
955
  ],
646
956
  "attributes": [
@@ -691,6 +1001,15 @@
691
1001
  },
692
1002
  "default": "['wilson']",
693
1003
  "fieldName": "confidenceIntervalMethods"
1004
+ },
1005
+ {
1006
+ "name": "size",
1007
+ "type": {
1008
+ "text": "{ width?: string; height?: string } | undefined"
1009
+ },
1010
+ "default": "undefined",
1011
+ "description": "The size of the component.\n\nIf not set, the component will take the full width of its container with height 700px.\n\nThe width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.\nIf the unit is %, the size will be relative to the container of the component.",
1012
+ "fieldName": "size"
694
1013
  }
695
1014
  ],
696
1015
  "superclass": {
@@ -730,7 +1049,7 @@
730
1049
  "type": {
731
1050
  "text": "Meta<RelativeGrowthAdvantageProps>"
732
1051
  },
733
- "default": "{\n title: 'Visualization/Relative growth advantage',\n component: 'gs-relative-growth-advantage',\n argTypes: {\n numerator: { control: 'object' },\n denominator: { control: 'object' },\n generationTime: { control: 'number' },\n views: {\n options: ['line'],\n control: { type: 'check' },\n },\n },\n}"
1052
+ "default": "{\n title: 'Visualization/Relative growth advantage',\n component: 'gs-relative-growth-advantage',\n argTypes: {\n numerator: { control: 'object' },\n denominator: { control: 'object' },\n generationTime: { control: 'number' },\n views: {\n options: ['line'],\n control: { type: 'check' },\n },\n size: [{ control: 'object' }],\n },\n}"
734
1053
  },
735
1054
  {
736
1055
  "kind": "variable",
@@ -738,7 +1057,7 @@
738
1057
  "type": {
739
1058
  "text": "StoryObj<RelativeGrowthAdvantageProps>"
740
1059
  },
741
- "default": "{\n ...Template,\n args: {\n numerator: { country: 'Switzerland', pangoLineage: 'B.1.1.7', dateFrom: '2020-12-01', dateTo: '2021-03-01' },\n denominator: { country: 'Switzerland', dateFrom: '2020-12-01', dateTo: '2021-03-01' },\n generationTime: 7,\n views: ['line'],\n },\n parameters: {\n fetchMock: {\n mocks: [\n {\n matcher: {\n name: 'numerator',\n url: AGGREGATED_ENDPOINT,\n body: {\n country: 'Switzerland',\n pangoLineage: 'B.1.1.7',\n dateFrom: '2020-12-01',\n dateTo: '2021-03-01',\n fields: ['date'],\n },\n },\n response: {\n status: 200,\n body: numerator,\n },\n },\n {\n matcher: {\n name: 'denominator',\n url: AGGREGATED_ENDPOINT,\n body: {\n country: 'Switzerland',\n dateFrom: '2020-12-01',\n dateTo: '2021-03-01',\n fields: ['date'],\n },\n },\n response: {\n status: 200,\n body: denominator,\n },\n },\n ],\n },\n },\n}"
1060
+ "default": "{\n ...Template,\n args: {\n numerator: { country: 'Switzerland', pangoLineage: 'B.1.1.7', dateFrom: '2020-12-01', dateTo: '2021-03-01' },\n denominator: { country: 'Switzerland', dateFrom: '2020-12-01', dateTo: '2021-03-01' },\n generationTime: 7,\n views: ['line'],\n size: { width: '100%', height: '700px' },\n },\n parameters: {\n fetchMock: {\n mocks: [\n {\n matcher: {\n name: 'numerator',\n url: AGGREGATED_ENDPOINT,\n body: {\n country: 'Switzerland',\n pangoLineage: 'B.1.1.7',\n dateFrom: '2020-12-01',\n dateTo: '2021-03-01',\n fields: ['date'],\n },\n },\n response: {\n status: 200,\n body: numerator,\n },\n },\n {\n matcher: {\n name: 'denominator',\n url: AGGREGATED_ENDPOINT,\n body: {\n country: 'Switzerland',\n dateFrom: '2020-12-01',\n dateTo: '2021-03-01',\n fields: ['date'],\n },\n },\n response: {\n status: 200,\n body: denominator,\n },\n },\n ],\n },\n },\n}"
742
1061
  }
743
1062
  ],
744
1063
  "exports": [
@@ -804,6 +1123,16 @@
804
1123
  },
805
1124
  "default": "['line']",
806
1125
  "attribute": "views"
1126
+ },
1127
+ {
1128
+ "kind": "field",
1129
+ "name": "size",
1130
+ "type": {
1131
+ "text": "{ width?: string; height?: string } | undefined"
1132
+ },
1133
+ "default": "undefined",
1134
+ "description": "The size of the component.\n\nIf not set, the component will take the full width of its container with height 700px.\n\nThe width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.\nIf the unit is %, the size will be relative to the container of the component.",
1135
+ "attribute": "size"
807
1136
  }
808
1137
  ],
809
1138
  "attributes": [
@@ -838,6 +1167,15 @@
838
1167
  },
839
1168
  "default": "['line']",
840
1169
  "fieldName": "views"
1170
+ },
1171
+ {
1172
+ "name": "size",
1173
+ "type": {
1174
+ "text": "{ width?: string; height?: string } | undefined"
1175
+ },
1176
+ "default": "undefined",
1177
+ "description": "The size of the component.\n\nIf not set, the component will take the full width of its container with height 700px.\n\nThe width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.\nIf the unit is %, the size will be relative to the container of the component.",
1178
+ "fieldName": "size"
841
1179
  }
842
1180
  ],
843
1181
  "superclass": {
@@ -906,17 +1244,17 @@
906
1244
  "kind": "variable",
907
1245
  "name": "meta",
908
1246
  "type": {
909
- "text": "Meta<DateRangeSelectorProps>"
1247
+ "text": "Meta<DateRangeSelectorProps<'CustomDateRange'>>"
910
1248
  },
911
- "default": "{\n title: 'Input/DateRangeSelector',\n component: 'gs-date-range-selector',\n parameters: {\n actions: {\n handles: ['gs-date-range-changed'],\n },\n fetchMock: {},\n },\n decorators: [withActions],\n}"
1249
+ "default": "{\n title: 'Input/DateRangeSelector',\n component: 'gs-date-range-selector',\n parameters: {\n actions: {\n handles: ['gs-date-range-changed'],\n },\n fetchMock: {},\n },\n argTypes: {\n initialValue: {\n control: {\n type: 'select',\n },\n options: [\n PRESET_VALUE_CUSTOM,\n PRESET_VALUE_ALL_TIMES,\n PRESET_VALUE_LAST_2_WEEKS,\n PRESET_VALUE_LAST_MONTH,\n PRESET_VALUE_LAST_2_MONTHS,\n PRESET_VALUE_LAST_3_MONTHS,\n PRESET_VALUE_LAST_6_MONTHS,\n 'CustomDateRange',\n ],\n },\n },\n args: {\n customSelectOptions: [{ label: 'CustomDateRange', dateFrom: '2021-01-01', dateTo: '2021-12-31' }],\n earliestDate: '1970-01-01',\n initialValue: PRESET_VALUE_LAST_6_MONTHS,\n },\n decorators: [withActions],\n}"
912
1250
  },
913
1251
  {
914
1252
  "kind": "variable",
915
1253
  "name": "DateRangeSelectorStory",
916
1254
  "type": {
917
- "text": "StoryObj<DateRangeSelectorProps>"
1255
+ "text": "StoryObj<DateRangeSelectorProps<'CustomDateRange'>>"
918
1256
  },
919
- "default": "{\n render: (args) =>\n html` <gs-app lapis=\"${LAPIS_URL}\">\n <div class=\"max-w-screen-lg\">\n <gs-date-range-selector\n .customSelectOptions=${args.customSelectOptions}\n .earliestDate=${args.earliestDate}\n ></gs-date-range-selector>\n </div>\n </gs-app>`,\n\n play: async ({ canvasElement, step }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-date-range-selector');\n const dateTo = () => canvas.getByPlaceholderText('Date to');\n\n await step('Expect last 6 months to be selected', async () => {\n await expect(canvas.getByRole('combobox')).toHaveValue('last6Months');\n await waitFor(() => {\n expect(dateTo()).toHaveValue(toYYYYMMDD(new Date()));\n });\n });\n },\n args: {\n customSelectOptions: [{ label: 'CustomDateRange', dateFrom: '2021-01-01', dateTo: '2021-12-31' }],\n earliestDate: '1970-01-01',\n },\n}"
1257
+ "default": "{\n render: (args) =>\n html` <gs-app lapis=\"${LAPIS_URL}\">\n <div class=\"max-w-screen-lg\">\n <gs-date-range-selector\n .customSelectOptions=${args.customSelectOptions}\n .earliestDate=${args.earliestDate}\n .initialValue=${args.initialValue}\n ></gs-date-range-selector>\n </div>\n </gs-app>`,\n play: async ({ canvasElement, step }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-date-range-selector');\n const dateTo = () => canvas.getByPlaceholderText('Date to');\n\n await step('Expect last 6 months to be selected', async () => {\n await expect(canvas.getByRole('combobox')).toHaveValue('last6Months');\n await waitFor(() => {\n expect(dateTo()).toHaveValue(toYYYYMMDD(new Date()));\n });\n });\n },\n}"
920
1258
  }
921
1259
  ],
922
1260
  "exports": [
@@ -951,7 +1289,7 @@
951
1289
  "kind": "field",
952
1290
  "name": "customSelectOptions",
953
1291
  "type": {
954
- "text": "CustomSelectOption[]"
1292
+ "text": "CustomSelectOption<CustomLabel>[]"
955
1293
  },
956
1294
  "default": "[]",
957
1295
  "attribute": "customSelectOptions"
@@ -964,6 +1302,15 @@
964
1302
  },
965
1303
  "default": "'1900-01-01'",
966
1304
  "attribute": "earliestDate"
1305
+ },
1306
+ {
1307
+ "kind": "field",
1308
+ "name": "initialValue",
1309
+ "type": {
1310
+ "text": "PresetOptionValues | CustomLabel | string | undefined"
1311
+ },
1312
+ "default": "''",
1313
+ "attribute": "initialValue"
967
1314
  }
968
1315
  ],
969
1316
  "events": [
@@ -979,7 +1326,7 @@
979
1326
  {
980
1327
  "name": "customSelectOptions",
981
1328
  "type": {
982
- "text": "CustomSelectOption[]"
1329
+ "text": "CustomSelectOption<CustomLabel>[]"
983
1330
  },
984
1331
  "default": "[]",
985
1332
  "fieldName": "customSelectOptions"
@@ -991,6 +1338,14 @@
991
1338
  },
992
1339
  "default": "'1900-01-01'",
993
1340
  "fieldName": "earliestDate"
1341
+ },
1342
+ {
1343
+ "name": "initialValue",
1344
+ "type": {
1345
+ "text": "PresetOptionValues | CustomLabel | string | undefined"
1346
+ },
1347
+ "default": "''",
1348
+ "fieldName": "initialValue"
994
1349
  }
995
1350
  ],
996
1351
  "superclass": {
@@ -1069,7 +1424,7 @@
1069
1424
  "type": {
1070
1425
  "text": "Meta"
1071
1426
  },
1072
- "default": "{\n title: 'Input/Location filter',\n component: 'gs-location-filter',\n parameters: {\n actions: {\n handles: ['gs-location-changed'],\n },\n },\n decorators: [withActions],\n}"
1427
+ "default": "{\n title: 'Input/Location filter',\n component: 'gs-location-filter',\n parameters: withComponentDocs({\n actions: {\n handles: ['gs-location-changed'],\n },\n componentDocs: {\n tag: 'gs-location-filter',\n opensShadowDom: true,\n expectsChildren: false,\n codeExample: `<gs-location-filter fields=\"['continent', 'country']\" value='Europe / Switzerland'></gs-location-filter>`,\n },\n }),\n decorators: [withActions],\n tags: ['autodocs'],\n}"
1073
1428
  },
1074
1429
  {
1075
1430
  "kind": "variable",
@@ -1093,7 +1448,7 @@
1093
1448
  "type": {
1094
1449
  "text": "StoryObj<LocationFilterProps>"
1095
1450
  },
1096
- "default": "{\n ...Template,\n parameters: {\n fetchMock: {\n mocks: [\n {\n matcher: aggregatedEndpointMatcher,\n response: {\n status: 500,\n body: { error: 'no data' },\n },\n },\n ],\n },\n },\n play: async ({ canvasElement }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-location-filter');\n\n await waitFor(() =>\n expect(\n canvas.getByText('Internal Server Error: {\"error\":\"no data\"} ', { exact: false }),\n ).toBeInTheDocument(),\n );\n },\n}"
1451
+ "default": "{\n ...Template,\n parameters: {\n fetchMock: {\n mocks: [\n {\n matcher: aggregatedEndpointMatcher,\n response: {\n status: 400,\n body: { error: 'no data' },\n },\n },\n ],\n },\n },\n play: async ({ canvasElement }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-location-filter');\n\n await waitFor(() =>\n expect(canvas.getByText('Bad Request: {\"error\":\"no data\"} ', { exact: false })).toBeInTheDocument(),\n );\n },\n}"
1097
1452
  },
1098
1453
  {
1099
1454
  "kind": "variable",
@@ -1153,18 +1508,18 @@
1153
1508
  "declarations": [
1154
1509
  {
1155
1510
  "kind": "class",
1156
- "description": "## Tag\n\n`gs-location-filter`\n\n## Context\n\nThis component provides an input field to specify filters for locations.\n\nIt expects a list of fields that form a strict hierarchical order, such as continent, country, and city.\nThe component retrieves a list of all possible values for these fields from the Lapis instance.\nThis list is then utilized to display autocomplete suggestions and to validate the input.\n\nGiven `fields` are `['field1', 'field2', ..., 'fieldN']`,\nthen valid values for the location filter must be in the form `valueForField1 / valueForField2 / ... / valueForFieldK`,\nwhere `1 <= K <= N`.\nValues for the fields `i > K` are considered `undefined`.",
1511
+ "description": "## Context\n\nThis component provides an input field to specify filters for locations.\n\nIt expects a list of fields that form a strict hierarchical order, such as continent, country, and city.\nThe component retrieves a list of all possible values for these fields from the Lapis instance.\nThis list is then utilized to display autocomplete suggestions and to validate the input.\n\nGiven `fields` are `['field1', 'field2', ..., 'fieldN']`,\nthen valid values for the location filter must be in the form `valueForField1 / valueForField2 / ... / valueForFieldK`,\nwhere `1 <= K <= N`.\nValues for the fields `i > K` are considered `undefined`.",
1157
1512
  "name": "LocationFilterComponent",
1158
1513
  "members": [
1159
1514
  {
1160
1515
  "kind": "field",
1161
- "name": "value",
1516
+ "name": "initialValue",
1162
1517
  "type": {
1163
1518
  "text": "string"
1164
1519
  },
1165
1520
  "default": "''",
1166
1521
  "description": "The initial value to use for this location filter.\nMust be of the form `valueForField1 / valueForField2 / ... / valueForFieldN`.",
1167
- "attribute": "value"
1522
+ "attribute": "initialValue"
1168
1523
  },
1169
1524
  {
1170
1525
  "kind": "field",
@@ -1188,13 +1543,13 @@
1188
1543
  ],
1189
1544
  "attributes": [
1190
1545
  {
1191
- "name": "value",
1546
+ "name": "initialValue",
1192
1547
  "type": {
1193
1548
  "text": "string"
1194
1549
  },
1195
1550
  "default": "''",
1196
1551
  "description": "The initial value to use for this location filter.\nMust be of the form `valueForField1 / valueForField2 / ... / valueForFieldN`.",
1197
- "fieldName": "value"
1552
+ "fieldName": "initialValue"
1198
1553
  },
1199
1554
  {
1200
1555
  "name": "fields",
@@ -1233,12 +1588,6 @@
1233
1588
  }
1234
1589
  ]
1235
1590
  },
1236
- {
1237
- "kind": "javascript-module",
1238
- "path": "src/web-components/input/location-filter.mdx",
1239
- "declarations": [],
1240
- "exports": []
1241
- },
1242
1591
  {
1243
1592
  "kind": "javascript-module",
1244
1593
  "path": "src/web-components/input/mutation-filter-component.stories.ts",
@@ -1255,25 +1604,25 @@
1255
1604
  "kind": "variable",
1256
1605
  "name": "Default",
1257
1606
  "type": {
1258
- "text": "StoryObj<{ lapisField: string; placeholderText: string }>"
1607
+ "text": "StoryObj<MutationFilterProps>"
1259
1608
  },
1260
- "default": "{\n render: () => {\n return html` <gs-app lapis=\"${LAPIS_URL}\">\n <div class=\"max-w-screen-lg\">\n <gs-mutation-filter></gs-mutation-filter>\n </div>\n </gs-app>`;\n },\n}"
1609
+ "default": "{\n ...Template,\n args: {\n initialValue: ['A123T'],\n },\n}"
1261
1610
  },
1262
1611
  {
1263
1612
  "kind": "variable",
1264
1613
  "name": "FiresFilterChangedEvent",
1265
1614
  "type": {
1266
- "text": "StoryObj<{ lapisField: string; placeholderText: string }>"
1615
+ "text": "StoryObj<MutationFilterProps>"
1267
1616
  },
1268
- "default": "{\n ...Default,\n play: async ({ canvasElement, step }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-mutation-filter');\n\n const inputField = () => canvas.getByPlaceholderText('Enter a mutation');\n const submitButton = () => canvas.getByRole('button', { name: '+' });\n const listenerMock = fn();\n await step('Setup event listener mock', async () => {\n canvasElement.addEventListener('gs-mutation-filter-changed', listenerMock);\n });\n\n await step('wait until data is loaded', async () => {\n await waitFor(() => {\n return expect(inputField()).toBeEnabled();\n });\n });\n\n await step('Enter a valid mutation', async () => {\n await userEvent.type(inputField(), 'A123T');\n await waitFor(() => submitButton().click());\n\n await waitFor(() =>\n expect(listenerMock).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: {\n nucleotideMutations: ['A123T'],\n aminoAcidMutations: [],\n nucleotideInsertions: [],\n aminoAcidInsertions: [],\n },\n }),\n ),\n );\n });\n },\n}"
1617
+ "default": "{\n ...Template,\n play: async ({ canvasElement, step }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-mutation-filter');\n\n const inputField = () => canvas.getByPlaceholderText('Enter a mutation', { exact: false });\n const submitButton = () => canvas.getByRole('button', { name: '+' });\n const listenerMock = fn();\n await step('Setup event listener mock', async () => {\n canvasElement.addEventListener('gs-mutation-filter-changed', listenerMock);\n });\n\n await step('wait until data is loaded', async () => {\n await waitFor(() => {\n return expect(inputField()).toBeEnabled();\n });\n });\n\n await step('Enter a valid mutation', async () => {\n await userEvent.type(inputField(), 'A123T');\n await waitFor(() => submitButton().click());\n\n await waitFor(() =>\n expect(listenerMock).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: {\n nucleotideMutations: ['A123T'],\n aminoAcidMutations: [],\n nucleotideInsertions: [],\n aminoAcidInsertions: [],\n },\n }),\n ),\n );\n });\n },\n}"
1269
1618
  },
1270
1619
  {
1271
1620
  "kind": "variable",
1272
1621
  "name": "FiresFilterOnBlurEvent",
1273
1622
  "type": {
1274
- "text": "StoryObj<{ lapisField: string; placeholderText: string }>"
1623
+ "text": "StoryObj<MutationFilterProps>"
1275
1624
  },
1276
- "default": "{\n ...Default,\n play: async ({ canvasElement, step }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-mutation-filter');\n\n const inputField = () => canvas.getByPlaceholderText('Enter a mutation');\n const listenerMock = fn();\n await step('Setup event listener mock', async () => {\n canvasElement.addEventListener('gs-mutation-filter-on-blur', listenerMock);\n });\n\n await step('wait until data is loaded', async () => {\n await waitFor(() => {\n return expect(inputField()).toBeEnabled();\n });\n });\n\n await step('Move outside of input', async () => {\n await userEvent.type(inputField(), 'A123T');\n await userEvent.tab();\n\n await expect(listenerMock).toHaveBeenCalled();\n });\n },\n}"
1625
+ "default": "{\n ...Template,\n play: async ({ canvasElement, step }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-mutation-filter');\n\n const inputField = () => canvas.getByPlaceholderText('Enter a mutation', { exact: false });\n const listenerMock = fn();\n await step('Setup event listener mock', async () => {\n canvasElement.addEventListener('gs-mutation-filter-on-blur', listenerMock);\n });\n\n await step('wait until data is loaded', async () => {\n await waitFor(() => {\n return expect(inputField()).toBeEnabled();\n });\n });\n\n await step('Move outside of input', async () => {\n await userEvent.type(inputField(), 'A123T');\n await userEvent.tab();\n\n await expect(listenerMock).toHaveBeenCalled();\n });\n },\n}"
1277
1626
  }
1278
1627
  ],
1279
1628
  "exports": [
@@ -1319,7 +1668,17 @@
1319
1668
  "kind": "class",
1320
1669
  "description": "",
1321
1670
  "name": "MutationFilterComponent",
1322
- "members": [],
1671
+ "members": [
1672
+ {
1673
+ "kind": "field",
1674
+ "name": "initialValue",
1675
+ "type": {
1676
+ "text": "SelectedMutationFilterStrings | string[] | undefined"
1677
+ },
1678
+ "default": "undefined",
1679
+ "attribute": "initialValue"
1680
+ }
1681
+ ],
1323
1682
  "events": [
1324
1683
  {
1325
1684
  "type": {
@@ -1336,6 +1695,16 @@
1336
1695
  "name": "gs-mutation-filter-on-blur"
1337
1696
  }
1338
1697
  ],
1698
+ "attributes": [
1699
+ {
1700
+ "name": "initialValue",
1701
+ "type": {
1702
+ "text": "SelectedMutationFilterStrings | string[] | undefined"
1703
+ },
1704
+ "default": "undefined",
1705
+ "fieldName": "initialValue"
1706
+ }
1707
+ ],
1339
1708
  "superclass": {
1340
1709
  "name": "PreactLitAdapter",
1341
1710
  "module": "/src/web-components/PreactLitAdapter"
@@ -1373,23 +1742,23 @@
1373
1742
  "type": {
1374
1743
  "text": "Meta"
1375
1744
  },
1376
- "default": "{\n title: 'Input/Text input',\n component: 'gs-text-input',\n parameters: {\n actions: {\n handles: ['gs-text-input-changed'],\n },\n fetchMock: {\n mocks: [\n {\n matcher: {\n name: 'hosts',\n url: AGGREGATED_ENDPOINT,\n body: {\n fields: ['host'],\n },\n },\n response: {\n status: 200,\n body: data,\n },\n },\n ],\n },\n },\n decorators: [withActions],\n tags: ['autodocs'],\n}"
1745
+ "default": "{\n title: 'Input/Text input',\n component: 'gs-text-input',\n parameters: {\n actions: {\n handles: ['gs-text-input-changed'],\n },\n fetchMock: {\n mocks: [\n {\n matcher: {\n name: 'hosts',\n url: AGGREGATED_ENDPOINT,\n body: {\n fields: ['host'],\n },\n },\n response: {\n status: 200,\n body: data,\n },\n },\n ],\n },\n },\n decorators: [withActions],\n}"
1377
1746
  },
1378
1747
  {
1379
1748
  "kind": "variable",
1380
1749
  "name": "Default",
1381
1750
  "type": {
1382
- "text": "StoryObj<{ lapisField: string; placeholderText: string }>"
1751
+ "text": "StoryObj<TextInputProps>"
1383
1752
  },
1384
- "default": "{\n render: (args) => {\n return html` <gs-app lapis=\"${LAPIS_URL}\">\n <div class=\"max-w-screen-lg\">\n <gs-text-input .lapisField=${args.lapisField} .placeholderText=${args.placeholderText}></gs-text-input>\n </div>\n </gs-app>`;\n },\n args: {\n lapisField: 'host',\n placeholderText: 'Enter host name',\n },\n}"
1753
+ "default": "{\n render: (args) => {\n return html` <gs-app lapis=\"${LAPIS_URL}\">\n <div class=\"max-w-screen-lg\">\n <gs-text-input\n .lapisField=${args.lapisField}\n .placeholderText=${args.placeholderText}\n .initialValue=${args.initialValue}\n ></gs-text-input>\n </div>\n </gs-app>`;\n },\n args: {\n lapisField: 'host',\n placeholderText: 'Enter host name',\n initialValue: 'Homo sapiens',\n },\n}"
1385
1754
  },
1386
1755
  {
1387
1756
  "kind": "variable",
1388
1757
  "name": "FiresEvent",
1389
1758
  "type": {
1390
- "text": "StoryObj<{ lapisField: string; placeholderText: string }>"
1759
+ "text": "StoryObj<TextInputProps>"
1391
1760
  },
1392
- "default": "{\n ...Default,\n play: async ({ canvasElement, step }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-text-input');\n\n const inputField = () => canvas.getByPlaceholderText('Enter host name');\n const listenerMock = fn();\n await step('Setup event listener mock', async () => {\n canvasElement.addEventListener('gs-text-input-changed', listenerMock);\n });\n\n await step('wait until data is loaded', async () => {\n await waitFor(() => {\n return expect(inputField()).toBeEnabled();\n });\n });\n\n await step('Enters an invalid host name', async () => {\n await userEvent.type(inputField(), 'notInList');\n await expect(listenerMock).not.toHaveBeenCalled();\n await userEvent.type(inputField(), '{backspace>9/}');\n });\n\n await step('Enter a valid host name', async () => {\n await userEvent.type(inputField(), 'Homo');\n\n await expect(listenerMock).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: {\n host: 'Homo',\n },\n }),\n );\n });\n },\n}"
1761
+ "default": "{\n ...Default,\n play: async ({ canvasElement, step }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-text-input');\n\n const inputField = () => canvas.getByPlaceholderText('Enter host name');\n const listenerMock = fn();\n await step('Setup event listener mock', async () => {\n canvasElement.addEventListener('gs-text-input-changed', listenerMock);\n });\n\n await step('wait until data is loaded', async () => {\n await waitFor(() => {\n return expect(inputField()).toBeEnabled();\n });\n });\n\n await step('Enters an invalid host name', async () => {\n await userEvent.type(inputField(), 'notInList');\n await expect(listenerMock).not.toHaveBeenCalled();\n await userEvent.type(inputField(), '{backspace>9/}');\n });\n\n await step('Enter a valid host name', async () => {\n await userEvent.type(inputField(), 'Homo');\n\n await expect(listenerMock).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: {\n host: 'Homo',\n },\n }),\n );\n });\n },\n args: {\n ...Default.args,\n initialValue: '',\n },\n}"
1393
1762
  }
1394
1763
  ],
1395
1764
  "exports": [
@@ -1428,6 +1797,15 @@
1428
1797
  "description": "",
1429
1798
  "name": "TextInputComponent",
1430
1799
  "members": [
1800
+ {
1801
+ "kind": "field",
1802
+ "name": "initialValue",
1803
+ "type": {
1804
+ "text": "string | undefined"
1805
+ },
1806
+ "default": "''",
1807
+ "attribute": "initialValue"
1808
+ },
1431
1809
  {
1432
1810
  "kind": "field",
1433
1811
  "name": "lapisField",
@@ -1441,7 +1819,7 @@
1441
1819
  "kind": "field",
1442
1820
  "name": "placeholderText",
1443
1821
  "type": {
1444
- "text": "string"
1822
+ "text": "string | undefined"
1445
1823
  },
1446
1824
  "default": "''",
1447
1825
  "attribute": "placeholderText"
@@ -1457,6 +1835,14 @@
1457
1835
  }
1458
1836
  ],
1459
1837
  "attributes": [
1838
+ {
1839
+ "name": "initialValue",
1840
+ "type": {
1841
+ "text": "string | undefined"
1842
+ },
1843
+ "default": "''",
1844
+ "fieldName": "initialValue"
1845
+ },
1460
1846
  {
1461
1847
  "name": "lapisField",
1462
1848
  "type": {
@@ -1468,7 +1854,7 @@
1468
1854
  {
1469
1855
  "name": "placeholderText",
1470
1856
  "type": {
1471
- "text": "string"
1857
+ "text": "string | undefined"
1472
1858
  },
1473
1859
  "default": "''",
1474
1860
  "fieldName": "placeholderText"