@genspectrum/dashboard-components 1.10.0 → 1.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/util.d.ts CHANGED
@@ -942,7 +942,7 @@ declare global {
942
942
 
943
943
  declare global {
944
944
  interface HTMLElementTagNameMap {
945
- 'gs-genome-data-viewer': GenomeDataViewerComponent;
945
+ 'gs-mutation-comparison-component': MutationComparisonComponent;
946
946
  }
947
947
  }
948
948
 
@@ -950,7 +950,7 @@ declare global {
950
950
  declare global {
951
951
  namespace JSX {
952
952
  interface IntrinsicElements {
953
- 'gs-genome-data-viewer': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
953
+ 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
954
954
  }
955
955
  }
956
956
  }
@@ -958,7 +958,7 @@ declare global {
958
958
 
959
959
  declare global {
960
960
  interface HTMLElementTagNameMap {
961
- 'gs-mutation-comparison-component': MutationComparisonComponent;
961
+ 'gs-genome-data-viewer': GenomeDataViewerComponent;
962
962
  }
963
963
  }
964
964
 
@@ -966,7 +966,7 @@ declare global {
966
966
  declare global {
967
967
  namespace JSX {
968
968
  interface IntrinsicElements {
969
- 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
969
+ 'gs-genome-data-viewer': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
970
970
  }
971
971
  }
972
972
  }
@@ -974,7 +974,7 @@ declare global {
974
974
 
975
975
  declare global {
976
976
  interface HTMLElementTagNameMap {
977
- 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
977
+ 'gs-mutations': MutationsComponent;
978
978
  }
979
979
  }
980
980
 
@@ -982,7 +982,7 @@ declare global {
982
982
  declare global {
983
983
  namespace JSX {
984
984
  interface IntrinsicElements {
985
- 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
985
+ 'gs-mutations': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
986
986
  }
987
987
  }
988
988
  }
@@ -990,7 +990,7 @@ declare global {
990
990
 
991
991
  declare global {
992
992
  interface HTMLElementTagNameMap {
993
- 'gs-mutations': MutationsComponent;
993
+ 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
994
994
  }
995
995
  }
996
996
 
@@ -998,7 +998,7 @@ declare global {
998
998
  declare global {
999
999
  namespace JSX {
1000
1000
  interface IntrinsicElements {
1001
- 'gs-mutations': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1001
+ 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1002
1002
  }
1003
1003
  }
1004
1004
  }
@@ -1054,7 +1054,7 @@ declare global {
1054
1054
 
1055
1055
  declare global {
1056
1056
  interface HTMLElementTagNameMap {
1057
- 'gs-mutations-over-time': MutationsOverTimeComponent;
1057
+ 'gs-sequences-by-location': SequencesByLocationComponent;
1058
1058
  }
1059
1059
  }
1060
1060
 
@@ -1062,7 +1062,7 @@ declare global {
1062
1062
  declare global {
1063
1063
  namespace JSX {
1064
1064
  interface IntrinsicElements {
1065
- 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1065
+ 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1066
1066
  }
1067
1067
  }
1068
1068
  }
@@ -1070,7 +1070,7 @@ declare global {
1070
1070
 
1071
1071
  declare global {
1072
1072
  interface HTMLElementTagNameMap {
1073
- 'gs-sequences-by-location': SequencesByLocationComponent;
1073
+ 'gs-mutations-over-time': MutationsOverTimeComponent;
1074
1074
  }
1075
1075
  }
1076
1076
 
@@ -1078,7 +1078,7 @@ declare global {
1078
1078
  declare global {
1079
1079
  namespace JSX {
1080
1080
  interface IntrinsicElements {
1081
- 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1081
+ 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1082
1082
  }
1083
1083
  }
1084
1084
  }
@@ -1100,6 +1100,22 @@ declare global {
1100
1100
  }
1101
1101
 
1102
1102
 
1103
+ declare global {
1104
+ interface HTMLElementTagNameMap {
1105
+ 'gs-wastewater-mutations-over-time': WastewaterMutationsOverTimeComponent;
1106
+ }
1107
+ }
1108
+
1109
+
1110
+ declare global {
1111
+ namespace JSX {
1112
+ interface IntrinsicElements {
1113
+ 'gs-wastewater-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1114
+ }
1115
+ }
1116
+ }
1117
+
1118
+
1103
1119
  declare global {
1104
1120
  interface HTMLElementTagNameMap {
1105
1121
  'gs-date-range-filter': DateRangeFilterComponent;
@@ -1217,22 +1233,6 @@ declare global {
1217
1233
  }
1218
1234
 
1219
1235
 
1220
- declare global {
1221
- interface HTMLElementTagNameMap {
1222
- 'gs-wastewater-mutations-over-time': WastewaterMutationsOverTimeComponent;
1223
- }
1224
- }
1225
-
1226
-
1227
- declare global {
1228
- namespace JSX {
1229
- interface IntrinsicElements {
1230
- 'gs-wastewater-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1231
- }
1232
- }
1233
- }
1234
-
1235
-
1236
1236
  declare module 'chart.js' {
1237
1237
  interface CartesianScaleTypeRegistry {
1238
1238
  logit: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genspectrum/dashboard-components",
3
- "version": "1.10.0",
3
+ "version": "1.10.2",
4
4
  "description": "GenSpectrum web components for building dashboards",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
@@ -171,7 +171,9 @@ export const SetsValueOnBlur: StoryObj<DateRangeFilterProps> = {
171
171
  },
172
172
  }),
173
173
  );
174
+ });
174
175
 
176
+ await waitFor(async () => {
175
177
  await expect(optionChangedListenerMock).toHaveBeenCalledWith(
176
178
  expect.objectContaining({
177
179
  detail: {
@@ -155,6 +155,54 @@ export const LineageFilter: StoryObj<Required<LineageFilterProps>> = {
155
155
  },
156
156
  };
157
157
 
158
+ export const LineageFilterStringValue: StoryObj<Required<LineageFilterProps>> = {
159
+ render: (args) => {
160
+ return html` <gs-app lapis="${LAPIS_URL}">
161
+ <div class="max-w-(--breakpoint-lg)">
162
+ <gs-lineage-filter
163
+ lapisField="pangoLineage"
164
+ placeholderText="Enter a lineage"
165
+ value="B.1.1.7"
166
+ .multiSelect=${args.multiSelect}
167
+ ></gs-lineage-filter>
168
+ </div>
169
+ </gs-app>`;
170
+ },
171
+ args: {
172
+ multiSelect: false,
173
+ },
174
+ play: async ({ canvasElement }) => {
175
+ const canvas = await withinShadowRoot(canvasElement, 'gs-lineage-filter');
176
+ await waitFor(() => {
177
+ return expect(canvas.getByPlaceholderText('Enter a lineage')).toBeVisible();
178
+ });
179
+ },
180
+ };
181
+
182
+ export const LineageFilterArrayValue: StoryObj<Required<LineageFilterProps>> = {
183
+ render: (args) => {
184
+ return html` <gs-app lapis="${LAPIS_URL}">
185
+ <div class="max-w-(--breakpoint-lg)">
186
+ <gs-lineage-filter
187
+ lapisField="pangoLineage"
188
+ placeholderText="Enter a lineage"
189
+ value='["B.1.1.7", "B.1.1.10"]'
190
+ .multiSelect=${args.multiSelect}
191
+ ></gs-lineage-filter>
192
+ </div>
193
+ </gs-app>`;
194
+ },
195
+ args: {
196
+ multiSelect: true,
197
+ },
198
+ play: async ({ canvasElement }) => {
199
+ const canvas = await withinShadowRoot(canvasElement, 'gs-lineage-filter');
200
+ await waitFor(() => {
201
+ return expect(canvas.getByPlaceholderText('Enter a lineage')).toBeVisible();
202
+ });
203
+ },
204
+ };
205
+
158
206
  export const DelayToShowLoadingState: StoryObj<Required<LineageFilterProps>> = {
159
207
  ...Template,
160
208
  parameters: {
@@ -49,7 +49,22 @@ export class LineageFilterComponent extends PreactLitAdapter {
49
49
  * Can be a string for single select mode or an array of strings (or comma-separated string) for multi-select mode.
50
50
  * Examples: "B.1.1.7" or ["B.1.1.7", "BA.5"] or "B.1.1.7,BA.5"
51
51
  */
52
- @property({ type: Array })
52
+ @property({
53
+ converter: (value) => {
54
+ if (value === null) {
55
+ return value;
56
+ }
57
+ try {
58
+ const parsed = JSON.parse(value) as unknown;
59
+ if (Array.isArray(parsed) && parsed.every((v) => typeof v === 'string')) {
60
+ return parsed;
61
+ }
62
+ return value;
63
+ } catch {
64
+ return value;
65
+ }
66
+ },
67
+ })
53
68
  value: string | string[] = '';
54
69
 
55
70
  /**
@@ -162,13 +162,15 @@ export const FiresEvents: StoryObj<Required<TextFilterProps>> = {
162
162
  await step('Remove initial value', async () => {
163
163
  await userEvent.click(canvas.getByRole('button', { name: 'clear selection' }));
164
164
 
165
- await expect(listenerMock).toHaveBeenCalledWith(
166
- expect.objectContaining({
167
- detail: {
168
- host: undefined,
169
- },
170
- }),
171
- );
165
+ await waitFor(async () => {
166
+ await expect(listenerMock).toHaveBeenCalledWith(
167
+ expect.objectContaining({
168
+ detail: {
169
+ host: undefined,
170
+ },
171
+ }),
172
+ );
173
+ });
172
174
  });
173
175
  },
174
176
  args: {
@@ -40215,7 +40215,18 @@ let so = class extends zn {
40215
40215
  }
40216
40216
  };
40217
40217
  is([
40218
- U({ type: Array })
40218
+ U({
40219
+ converter: (n) => {
40220
+ if (n === null)
40221
+ return n;
40222
+ try {
40223
+ const e = JSON.parse(n);
40224
+ return Array.isArray(e) && e.every((t) => typeof t == "string") ? e : n;
40225
+ } catch {
40226
+ return n;
40227
+ }
40228
+ }
40229
+ })
40219
40230
  ], so.prototype, "value", 2);
40220
40231
  is([
40221
40232
  U()