@genspectrum/dashboard-components 0.12.0 → 0.13.0

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 (37) hide show
  1. package/custom-elements.json +117 -28
  2. package/dist/{LocationChangedEvent-CORvQvXv.js → LineageFilterChangedEvent-GedKNGFI.js} +25 -3
  3. package/dist/LineageFilterChangedEvent-GedKNGFI.js.map +1 -0
  4. package/dist/components.d.ts +86 -52
  5. package/dist/components.js +251 -196
  6. package/dist/components.js.map +1 -1
  7. package/dist/util.d.ts +59 -45
  8. package/dist/util.js +3 -1
  9. package/package.json +1 -1
  10. package/src/preact/components/downshift-combobox.tsx +145 -0
  11. package/src/preact/lineageFilter/LineageFilterChangedEvent.ts +11 -0
  12. package/src/preact/lineageFilter/fetchLineageAutocompleteList.spec.ts +16 -2
  13. package/src/preact/lineageFilter/fetchLineageAutocompleteList.ts +13 -2
  14. package/src/preact/lineageFilter/lineage-filter.stories.tsx +110 -9
  15. package/src/preact/lineageFilter/lineage-filter.tsx +40 -50
  16. package/src/preact/locationFilter/LocationChangedEvent.ts +1 -1
  17. package/src/preact/locationFilter/fetchAutocompletionList.spec.ts +6 -2
  18. package/src/preact/locationFilter/fetchAutocompletionList.ts +16 -6
  19. package/src/preact/locationFilter/location-filter.stories.tsx +33 -30
  20. package/src/preact/locationFilter/location-filter.tsx +47 -144
  21. package/src/preact/map/sequences-by-location-map.tsx +3 -3
  22. package/src/preact/textInput/TextInputChangedEvent.ts +11 -0
  23. package/src/preact/textInput/fetchStringAutocompleteList.ts +20 -0
  24. package/src/preact/textInput/text-input.stories.tsx +34 -14
  25. package/src/preact/textInput/text-input.tsx +47 -45
  26. package/src/types.ts +3 -0
  27. package/src/utilEntrypoint.ts +2 -0
  28. package/src/web-components/input/gs-lineage-filter.stories.ts +120 -31
  29. package/src/web-components/input/gs-lineage-filter.tsx +24 -8
  30. package/src/web-components/input/gs-location-filter.stories.ts +9 -0
  31. package/src/web-components/input/gs-location-filter.tsx +21 -3
  32. package/src/web-components/input/gs-text-input.stories.ts +44 -12
  33. package/src/web-components/input/gs-text-input.tsx +23 -7
  34. package/standalone-bundle/dashboard-components.js +4931 -4863
  35. package/standalone-bundle/dashboard-components.js.map +1 -1
  36. package/dist/LocationChangedEvent-CORvQvXv.js.map +0 -1
  37. package/src/preact/textInput/fetchAutocompleteList.ts +0 -9
@@ -230,11 +230,11 @@ export { ErrorEvent_2 as ErrorEvent }
230
230
  * Currently, it is designed to work well with Pango Lineages,
231
231
  * but it may also be used for other lineage types, if suitable.
232
232
  *
233
- * It fetches all available values of the `lapisField` from the LAPIS instance
233
+ * It fetches all available values of the `lapisField` from the LAPIS instance within the given `lapisFilter`
234
234
  * and provides an autocomplete list with the available values of the lineage and sublineage queries
235
235
  * (a `*` appended to the lineage value).
236
236
  *
237
- * @fires {CustomEvent<Record<string, string>>} gs-lineage-filter-changed
237
+ * @fires {CustomEvent<Record<string, string | undefined>>} gs-lineage-filter-changed
238
238
  * Fired when the input field is changed.
239
239
  * The `details` of this event contain an object with the `lapisField` as key and the input value as value.
240
240
  * Example:
@@ -248,7 +248,7 @@ export declare class LineageFilterComponent extends PreactLitAdapter {
248
248
  /**
249
249
  * The initial value to use for this lineage filter.
250
250
  */
251
- initialValue: string;
251
+ value: string;
252
252
  /**
253
253
  * Required.
254
254
  *
@@ -256,6 +256,17 @@ export declare class LineageFilterComponent extends PreactLitAdapter {
256
256
  * The field must exist on this LAPIS instance.
257
257
  */
258
258
  lapisField: string;
259
+ /**
260
+ * The filter that is used to fetch the available the autocomplete options.
261
+ * If not set it fetches all available options.
262
+ * It must be a valid LAPIS filter object.
263
+ */
264
+ lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
265
+ nucleotideMutations?: string[];
266
+ aminoAcidMutations?: string[];
267
+ nucleotideInsertions?: string[];
268
+ aminoAcidInsertions?: string[];
269
+ };
259
270
  /**
260
271
  * The placeholder text to display in the input field.
261
272
  */
@@ -275,10 +286,11 @@ export declare class LineageFilterComponent extends PreactLitAdapter {
275
286
  * This component provides an input field to specify filters for locations.
276
287
  *
277
288
  * It expects a list of fields that form a strict hierarchical order, such as continent, country, and city.
278
- * The component retrieves a list of all possible values for these fields from the Lapis instance.
289
+ * The component retrieves a list of all possible values for these fields from the Lapis instance,
290
+ * within the `lapisFilter`.
279
291
  * This list is then utilized to display autocomplete suggestions and to validate the input.
280
292
  *
281
- * @fires {CustomEvent<Record<string, string>>} gs-location-changed
293
+ * @fires {CustomEvent<Record<string, string | undefined>>} gs-location-changed
282
294
  * Fired when a value from the datalist is selected or when a valid value is typed into the field.
283
295
  * The `details` of this event contain an object with all `fields` as keys
284
296
  * and the corresponding values as values, even if they are `undefined`.
@@ -296,7 +308,7 @@ export declare class LocationFilterComponent extends PreactLitAdapter {
296
308
  /**
297
309
  * The initial value to use for this location filter.
298
310
  */
299
- value: Record<string, string | null | undefined> | undefined;
311
+ value: Record<string, string | undefined> | undefined;
300
312
  /**
301
313
  * Required.
302
314
  *
@@ -306,6 +318,17 @@ export declare class LocationFilterComponent extends PreactLitAdapter {
306
318
  * (e.g., `fields = ['continent', 'country', 'city']`).
307
319
  */
308
320
  fields: string[];
321
+ /**
322
+ * The filter that is used to fetch the available the autocomplete options.
323
+ * If not set it fetches all available options.
324
+ * It must be a valid LAPIS filter object.
325
+ */
326
+ lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
327
+ nucleotideMutations?: string[];
328
+ aminoAcidMutations?: string[];
329
+ nucleotideInsertions?: string[];
330
+ aminoAcidInsertions?: string[];
331
+ };
309
332
  /**
310
333
  * The width of the component.
311
334
  *
@@ -1195,7 +1218,7 @@ export declare class StatisticsComponent extends PreactLitAdapterWithGridJsStyle
1195
1218
  *
1196
1219
  * This component provides a text input field to specify filters for arbitrary fields of this LAPIS instance.
1197
1220
  *
1198
- * @fires {CustomEvent<Record<string, string>>} gs-text-input-changed
1221
+ * @fires {CustomEvent<Record<string, string | undefined>>} gs-text-input-changed
1199
1222
  * Fired when the input field is changed.
1200
1223
  * The `details` of this event contain an object with the `lapisField` as key and the input value as value.
1201
1224
  * Example:
@@ -1209,7 +1232,7 @@ export declare class TextInputComponent extends PreactLitAdapter {
1209
1232
  /**
1210
1233
  * The initial value to use for this text input.
1211
1234
  */
1212
- initialValue: string | undefined;
1235
+ value: string | undefined;
1213
1236
  /**
1214
1237
  * Required.
1215
1238
  *
@@ -1217,6 +1240,17 @@ export declare class TextInputComponent extends PreactLitAdapter {
1217
1240
  * The field must exist on this LAPIS instance.
1218
1241
  */
1219
1242
  lapisField: string;
1243
+ /**
1244
+ * The filter that is used to fetch the available the autocomplete options.
1245
+ * If not set it fetches all available options.
1246
+ * It must be a valid LAPIS filter object.
1247
+ */
1248
+ lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
1249
+ nucleotideMutations?: string[];
1250
+ aminoAcidMutations?: string[];
1251
+ nucleotideInsertions?: string[];
1252
+ aminoAcidInsertions?: string[];
1253
+ };
1220
1254
  /**
1221
1255
  * The placeholder text to display in the input field.
1222
1256
  */
@@ -1263,10 +1297,7 @@ declare global {
1263
1297
 
1264
1298
  declare global {
1265
1299
  interface HTMLElementTagNameMap {
1266
- 'gs-location-filter': LocationFilterComponent;
1267
- }
1268
- interface HTMLElementEventMap {
1269
- 'gs-location-changed': LocationChangedEvent;
1300
+ 'gs-mutation-comparison-component': MutationComparisonComponent;
1270
1301
  }
1271
1302
  }
1272
1303
 
@@ -1274,7 +1305,7 @@ declare global {
1274
1305
  declare global {
1275
1306
  namespace JSX {
1276
1307
  interface IntrinsicElements {
1277
- 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1308
+ 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1278
1309
  }
1279
1310
  }
1280
1311
  }
@@ -1282,11 +1313,7 @@ declare global {
1282
1313
 
1283
1314
  declare global {
1284
1315
  interface HTMLElementTagNameMap {
1285
- 'gs-date-range-selector': DateRangeSelectorComponent;
1286
- }
1287
- interface HTMLElementEventMap {
1288
- 'gs-date-range-filter-changed': CustomEvent<Record<string, string>>;
1289
- 'gs-date-range-option-changed': DateRangeOptionChangedEvent;
1316
+ 'gs-mutations-component': MutationsComponent;
1290
1317
  }
1291
1318
  }
1292
1319
 
@@ -1294,7 +1321,7 @@ declare global {
1294
1321
  declare global {
1295
1322
  namespace JSX {
1296
1323
  interface IntrinsicElements {
1297
- 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1324
+ 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1298
1325
  }
1299
1326
  }
1300
1327
  }
@@ -1302,10 +1329,7 @@ declare global {
1302
1329
 
1303
1330
  declare global {
1304
1331
  interface HTMLElementTagNameMap {
1305
- 'gs-text-input': TextInputComponent;
1306
- }
1307
- interface HTMLElementEventMap {
1308
- 'gs-text-input-changed': CustomEvent<Record<string, string>>;
1332
+ 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1309
1333
  }
1310
1334
  }
1311
1335
 
@@ -1313,7 +1337,7 @@ declare global {
1313
1337
  declare global {
1314
1338
  namespace JSX {
1315
1339
  interface IntrinsicElements {
1316
- 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1340
+ 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1317
1341
  }
1318
1342
  }
1319
1343
  }
@@ -1321,10 +1345,7 @@ declare global {
1321
1345
 
1322
1346
  declare global {
1323
1347
  interface HTMLElementTagNameMap {
1324
- 'gs-mutation-filter': MutationFilterComponent;
1325
- }
1326
- interface HTMLElementEventMap {
1327
- 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
1348
+ 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
1328
1349
  }
1329
1350
  }
1330
1351
 
@@ -1332,7 +1353,7 @@ declare global {
1332
1353
  declare global {
1333
1354
  namespace JSX {
1334
1355
  interface IntrinsicElements {
1335
- 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1356
+ 'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1336
1357
  }
1337
1358
  }
1338
1359
  }
@@ -1340,10 +1361,7 @@ declare global {
1340
1361
 
1341
1362
  declare global {
1342
1363
  interface HTMLElementTagNameMap {
1343
- 'gs-lineage-filter': LineageFilterComponent;
1344
- }
1345
- interface HTMLElementEventMap {
1346
- 'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
1364
+ 'gs-aggregate': AggregateComponent;
1347
1365
  }
1348
1366
  }
1349
1367
 
@@ -1351,7 +1369,7 @@ declare global {
1351
1369
  declare global {
1352
1370
  namespace JSX {
1353
1371
  interface IntrinsicElements {
1354
- 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1372
+ 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1355
1373
  }
1356
1374
  }
1357
1375
  }
@@ -1359,7 +1377,7 @@ declare global {
1359
1377
 
1360
1378
  declare global {
1361
1379
  interface HTMLElementTagNameMap {
1362
- 'gs-mutation-comparison-component': MutationComparisonComponent;
1380
+ 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1363
1381
  }
1364
1382
  }
1365
1383
 
@@ -1367,7 +1385,7 @@ declare global {
1367
1385
  declare global {
1368
1386
  namespace JSX {
1369
1387
  interface IntrinsicElements {
1370
- 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1388
+ 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1371
1389
  }
1372
1390
  }
1373
1391
  }
@@ -1375,7 +1393,7 @@ declare global {
1375
1393
 
1376
1394
  declare global {
1377
1395
  interface HTMLElementTagNameMap {
1378
- 'gs-mutations-component': MutationsComponent;
1396
+ 'gs-mutations-over-time': MutationsOverTimeComponent;
1379
1397
  }
1380
1398
  }
1381
1399
 
@@ -1383,7 +1401,7 @@ declare global {
1383
1401
  declare global {
1384
1402
  namespace JSX {
1385
1403
  interface IntrinsicElements {
1386
- 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1404
+ 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1387
1405
  }
1388
1406
  }
1389
1407
  }
@@ -1391,7 +1409,7 @@ declare global {
1391
1409
 
1392
1410
  declare global {
1393
1411
  interface HTMLElementTagNameMap {
1394
- 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1412
+ 'gs-sequences-by-location': SequencesByLocationComponent;
1395
1413
  }
1396
1414
  }
1397
1415
 
@@ -1399,7 +1417,7 @@ declare global {
1399
1417
  declare global {
1400
1418
  namespace JSX {
1401
1419
  interface IntrinsicElements {
1402
- 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1420
+ 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1403
1421
  }
1404
1422
  }
1405
1423
  }
@@ -1407,7 +1425,7 @@ declare global {
1407
1425
 
1408
1426
  declare global {
1409
1427
  interface HTMLElementTagNameMap {
1410
- 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
1428
+ 'gs-statistics': StatisticsComponent;
1411
1429
  }
1412
1430
  }
1413
1431
 
@@ -1415,7 +1433,7 @@ declare global {
1415
1433
  declare global {
1416
1434
  namespace JSX {
1417
1435
  interface IntrinsicElements {
1418
- 'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1436
+ 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1419
1437
  }
1420
1438
  }
1421
1439
  }
@@ -1423,7 +1441,11 @@ declare global {
1423
1441
 
1424
1442
  declare global {
1425
1443
  interface HTMLElementTagNameMap {
1426
- 'gs-aggregate': AggregateComponent;
1444
+ 'gs-date-range-selector': DateRangeSelectorComponent;
1445
+ }
1446
+ interface HTMLElementEventMap {
1447
+ 'gs-date-range-filter-changed': CustomEvent<Record<string, string>>;
1448
+ 'gs-date-range-option-changed': DateRangeOptionChangedEvent;
1427
1449
  }
1428
1450
  }
1429
1451
 
@@ -1431,7 +1453,7 @@ declare global {
1431
1453
  declare global {
1432
1454
  namespace JSX {
1433
1455
  interface IntrinsicElements {
1434
- 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1456
+ 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1435
1457
  }
1436
1458
  }
1437
1459
  }
@@ -1439,7 +1461,10 @@ declare global {
1439
1461
 
1440
1462
  declare global {
1441
1463
  interface HTMLElementTagNameMap {
1442
- 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1464
+ 'gs-location-filter': LocationFilterComponent;
1465
+ }
1466
+ interface HTMLElementEventMap {
1467
+ 'gs-location-changed': LocationChangedEvent;
1443
1468
  }
1444
1469
  }
1445
1470
 
@@ -1447,7 +1472,7 @@ declare global {
1447
1472
  declare global {
1448
1473
  namespace JSX {
1449
1474
  interface IntrinsicElements {
1450
- 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1475
+ 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1451
1476
  }
1452
1477
  }
1453
1478
  }
@@ -1455,7 +1480,10 @@ declare global {
1455
1480
 
1456
1481
  declare global {
1457
1482
  interface HTMLElementTagNameMap {
1458
- 'gs-mutations-over-time': MutationsOverTimeComponent;
1483
+ 'gs-text-input': TextInputComponent;
1484
+ }
1485
+ interface HTMLElementEventMap {
1486
+ 'gs-text-input-changed': TextInputChangedEvent;
1459
1487
  }
1460
1488
  }
1461
1489
 
@@ -1463,7 +1491,7 @@ declare global {
1463
1491
  declare global {
1464
1492
  namespace JSX {
1465
1493
  interface IntrinsicElements {
1466
- 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1494
+ 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1467
1495
  }
1468
1496
  }
1469
1497
  }
@@ -1471,7 +1499,10 @@ declare global {
1471
1499
 
1472
1500
  declare global {
1473
1501
  interface HTMLElementTagNameMap {
1474
- 'gs-sequences-by-location': SequencesByLocationComponent;
1502
+ 'gs-mutation-filter': MutationFilterComponent;
1503
+ }
1504
+ interface HTMLElementEventMap {
1505
+ 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
1475
1506
  }
1476
1507
  }
1477
1508
 
@@ -1479,7 +1510,7 @@ declare global {
1479
1510
  declare global {
1480
1511
  namespace JSX {
1481
1512
  interface IntrinsicElements {
1482
- 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1513
+ 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1483
1514
  }
1484
1515
  }
1485
1516
  }
@@ -1487,7 +1518,10 @@ declare global {
1487
1518
 
1488
1519
  declare global {
1489
1520
  interface HTMLElementTagNameMap {
1490
- 'gs-statistics': StatisticsComponent;
1521
+ 'gs-lineage-filter': LineageFilterComponent;
1522
+ }
1523
+ interface HTMLElementEventMap {
1524
+ 'gs-lineage-filter-changed': LineageFilterChangedEvent;
1491
1525
  }
1492
1526
  }
1493
1527
 
@@ -1495,7 +1529,7 @@ declare global {
1495
1529
  declare global {
1496
1530
  namespace JSX {
1497
1531
  interface IntrinsicElements {
1498
- 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1532
+ 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1499
1533
  }
1500
1534
  }
1501
1535
  }