@genspectrum/dashboard-components 0.13.3 → 0.13.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3961,17 +3961,17 @@
3961
3961
  "kind": "variable",
3962
3962
  "name": "meta",
3963
3963
  "type": {
3964
- "text": "Meta<Required<WastewaterMutationsOverTimeProps>>"
3964
+ "text": "Meta<WastewaterMutationsOverTimeProps & { infoText: string }>"
3965
3965
  },
3966
- "default": "{ title: 'Wastewater visualization/Wastewater mutations over time', component: 'gs-wastewater-mutations-over-time', argTypes: { lapisFilter: { control: 'object' }, sequenceType: { options: ['nucleotide', 'amino acid'], control: { type: 'radio' }, }, width: { control: 'text' }, height: { control: 'text' }, }, args: { lapisFilter: { versionStatus: 'LATEST_VERSION', isRevocation: false }, sequenceType: 'nucleotide', width: '100%', height: '700px', }, parameters: withComponentDocs({ componentDocs: { opensShadowDom: true, expectsChildren: false, codeExample, }, fetchMock: {}, }), tags: ['autodocs'], }"
3966
+ "default": "{ title: 'Wastewater visualization/Wastewater mutations over time', component: 'gs-wastewater-mutations-over-time', argTypes: { lapisFilter: { control: 'object' }, sequenceType: { options: ['nucleotide', 'amino acid'], control: { type: 'radio' }, }, width: { control: 'text' }, height: { control: 'text' }, }, args: { lapisFilter: { versionStatus: 'LATEST_VERSION', isRevocation: false }, sequenceType: 'nucleotide', width: '100%', height: '700px', infoText: 'Some info text', }, parameters: withComponentDocs({ componentDocs: { opensShadowDom: true, expectsChildren: false, codeExample, }, fetchMock: {}, }), tags: ['autodocs'], }"
3967
3967
  },
3968
3968
  {
3969
3969
  "kind": "variable",
3970
3970
  "name": "WastewaterMutationsOverTime",
3971
3971
  "type": {
3972
- "text": "StoryObj<Required<WastewaterMutationsOverTimeProps>>"
3972
+ "text": "StoryObj<WastewaterMutationsOverTimeProps & { infoText: string }>"
3973
3973
  },
3974
- "default": "{ render: (args) => html` <gs-app lapis=\"${WISE_LAPIS_URL}\"> <gs-wastewater-mutations-over-time .lapisFilter=${args.lapisFilter} .sequenceType=${args.sequenceType} .width=${args.width} .height=${args.height} ></gs-wastewater-mutations-over-time> </gs-app> `, parameters: { fetchMock: { mocks: [ { matcher: { name: 'details', url: WISE_DETAILS_ENDPOINT, body: { fields: ['date', 'location', 'nucleotideMutationFrequency', 'aminoAcidMutationFrequency'], versionStatus: 'LATEST_VERSION', isRevocation: false, }, }, response: { status: 200, body: details, }, }, ], }, }, }"
3974
+ "default": "{ render: (args) => html` <gs-app lapis=\"${WISE_LAPIS_URL}\"> <gs-wastewater-mutations-over-time .lapisFilter=${args.lapisFilter} .sequenceType=${args.sequenceType} .width=${args.width} .height=${args.height} > <span slot=\"infoText\">${args.infoText}</span> </gs-wastewater-mutations-over-time> </gs-app> `, parameters: { fetchMock: { mocks: [ { matcher: { name: 'details', url: WISE_DETAILS_ENDPOINT, body: { fields: ['date', 'location', 'nucleotideMutationFrequency', 'aminoAcidMutationFrequency'], versionStatus: 'LATEST_VERSION', isRevocation: false, }, }, response: { status: 200, body: details, }, }, ], }, }, }"
3975
3975
  }
3976
3976
  ],
3977
3977
  "exports": [
@@ -4001,6 +4001,12 @@
4001
4001
  "kind": "class",
4002
4002
  "description": "## Context\n\nThis component displays mutations for Swiss wastewater data generated within the WISE consortium. It is designed\nonly for this purpose and is not designed to be reused outside the WISE project.\n\nIt relies on a LAPIS instance that has the fields `nucleotideMutationFrequency` and `aminoAcidMutationFrequency`.\nThose fields are expected to be JSON strings of the format `{ [mutation]: frequency | null }`\n(e.g. `{ \"A123T\": 0.5, \"C456G\": 0.7, \"T789G\": null }`).\n\nThe component will stratify by `location`.\nEvery location will be rendered in a separate tab.\nThe content of the tab is a \"mutations over time\" grid, similar to the one used in the `gs-mutations-over-time` component.\n\nThis component also assumes that the LAPIS instance has the field `date` which can be used for the time axis.",
4003
4003
  "name": "WastewaterMutationsOverTimeComponent",
4004
+ "slots": [
4005
+ {
4006
+ "description": "Additional information text to be shown in the info modal (the \"?\" button).",
4007
+ "name": "infoText"
4008
+ }
4009
+ ],
4004
4010
  "members": [
4005
4011
  {
4006
4012
  "kind": "field",
@@ -4041,6 +4047,16 @@
4041
4047
  "default": "'700px'",
4042
4048
  "description": "The height of the component.\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.",
4043
4049
  "attribute": "height"
4050
+ },
4051
+ {
4052
+ "kind": "field",
4053
+ "name": "maxNumberOfGridRows",
4054
+ "type": {
4055
+ "text": "number"
4056
+ },
4057
+ "default": "100",
4058
+ "description": "The maximum number of grid rows to display.\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.",
4059
+ "attribute": "maxNumberOfGridRows"
4044
4060
  }
4045
4061
  ],
4046
4062
  "attributes": [
@@ -4079,6 +4095,15 @@
4079
4095
  "default": "'700px'",
4080
4096
  "description": "The height of the component.\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.",
4081
4097
  "fieldName": "height"
4098
+ },
4099
+ {
4100
+ "name": "maxNumberOfGridRows",
4101
+ "type": {
4102
+ "text": "number"
4103
+ },
4104
+ "default": "100",
4105
+ "description": "The maximum number of grid rows to display.\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.",
4106
+ "fieldName": "maxNumberOfGridRows"
4082
4107
  }
4083
4108
  ],
4084
4109
  "superclass": {
@@ -1284,6 +1284,8 @@ export declare class UserFacingError extends Error {
1284
1284
  * The content of the tab is a "mutations over time" grid, similar to the one used in the `gs-mutations-over-time` component.
1285
1285
  *
1286
1286
  * This component also assumes that the LAPIS instance has the field `date` which can be used for the time axis.
1287
+ *
1288
+ * @slot infoText - Additional information text to be shown in the info modal (the "?" button).
1287
1289
  */
1288
1290
  export declare class WastewaterMutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles {
1289
1291
  /**
@@ -1315,6 +1317,12 @@ export declare class WastewaterMutationsOverTimeComponent extends PreactLitAdapt
1315
1317
  * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
1316
1318
  */
1317
1319
  height: string;
1320
+ /**
1321
+ * The maximum number of grid rows to display.
1322
+ *
1323
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
1324
+ */
1325
+ maxNumberOfGridRows: number;
1318
1326
  render(): JSX_2.Element;
1319
1327
  }
1320
1328
 
@@ -1362,7 +1370,7 @@ declare global {
1362
1370
 
1363
1371
  declare global {
1364
1372
  interface HTMLElementTagNameMap {
1365
- 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1373
+ 'gs-mutations-component': MutationsComponent;
1366
1374
  }
1367
1375
  }
1368
1376
 
@@ -1370,7 +1378,7 @@ declare global {
1370
1378
  declare global {
1371
1379
  namespace JSX {
1372
1380
  interface IntrinsicElements {
1373
- 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1381
+ 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1374
1382
  }
1375
1383
  }
1376
1384
  }
@@ -1378,7 +1386,7 @@ declare global {
1378
1386
 
1379
1387
  declare global {
1380
1388
  interface HTMLElementTagNameMap {
1381
- 'gs-mutations-component': MutationsComponent;
1389
+ 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1382
1390
  }
1383
1391
  }
1384
1392
 
@@ -1386,7 +1394,7 @@ declare global {
1386
1394
  declare global {
1387
1395
  namespace JSX {
1388
1396
  interface IntrinsicElements {
1389
- 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1397
+ 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1390
1398
  }
1391
1399
  }
1392
1400
  }
@@ -1526,10 +1534,10 @@ declare global {
1526
1534
 
1527
1535
  declare global {
1528
1536
  interface HTMLElementTagNameMap {
1529
- 'gs-location-filter': LocationFilterComponent;
1537
+ 'gs-text-input': TextInputComponent;
1530
1538
  }
1531
1539
  interface HTMLElementEventMap {
1532
- 'gs-location-changed': LocationChangedEvent;
1540
+ 'gs-text-input-changed': TextInputChangedEvent;
1533
1541
  }
1534
1542
  }
1535
1543
 
@@ -1537,7 +1545,7 @@ declare global {
1537
1545
  declare global {
1538
1546
  namespace JSX {
1539
1547
  interface IntrinsicElements {
1540
- 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1548
+ 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1541
1549
  }
1542
1550
  }
1543
1551
  }
@@ -1545,10 +1553,10 @@ declare global {
1545
1553
 
1546
1554
  declare global {
1547
1555
  interface HTMLElementTagNameMap {
1548
- 'gs-lineage-filter': LineageFilterComponent;
1556
+ 'gs-location-filter': LocationFilterComponent;
1549
1557
  }
1550
1558
  interface HTMLElementEventMap {
1551
- 'gs-lineage-filter-changed': LineageFilterChangedEvent;
1559
+ 'gs-location-changed': LocationChangedEvent;
1552
1560
  }
1553
1561
  }
1554
1562
 
@@ -1556,7 +1564,7 @@ declare global {
1556
1564
  declare global {
1557
1565
  namespace JSX {
1558
1566
  interface IntrinsicElements {
1559
- 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1567
+ 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1560
1568
  }
1561
1569
  }
1562
1570
  }
@@ -1564,10 +1572,10 @@ declare global {
1564
1572
 
1565
1573
  declare global {
1566
1574
  interface HTMLElementTagNameMap {
1567
- 'gs-text-input': TextInputComponent;
1575
+ 'gs-mutation-filter': MutationFilterComponent;
1568
1576
  }
1569
1577
  interface HTMLElementEventMap {
1570
- 'gs-text-input-changed': TextInputChangedEvent;
1578
+ 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
1571
1579
  }
1572
1580
  }
1573
1581
 
@@ -1575,7 +1583,7 @@ declare global {
1575
1583
  declare global {
1576
1584
  namespace JSX {
1577
1585
  interface IntrinsicElements {
1578
- 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1586
+ 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1579
1587
  }
1580
1588
  }
1581
1589
  }
@@ -1583,10 +1591,10 @@ declare global {
1583
1591
 
1584
1592
  declare global {
1585
1593
  interface HTMLElementTagNameMap {
1586
- 'gs-mutation-filter': MutationFilterComponent;
1594
+ 'gs-lineage-filter': LineageFilterComponent;
1587
1595
  }
1588
1596
  interface HTMLElementEventMap {
1589
- 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
1597
+ 'gs-lineage-filter-changed': LineageFilterChangedEvent;
1590
1598
  }
1591
1599
  }
1592
1600
 
@@ -1594,7 +1602,7 @@ declare global {
1594
1602
  declare global {
1595
1603
  namespace JSX {
1596
1604
  interface IntrinsicElements {
1597
- 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1605
+ 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1598
1606
  }
1599
1607
  }
1600
1608
  }
@@ -9472,15 +9472,20 @@ const Tooltip = ({ children, content, position = "bottom" }) => {
9472
9472
  };
9473
9473
  const MAX_NUMBER_OF_GRID_ROWS = 100;
9474
9474
  const MUTATION_CELL_WIDTH_REM = 8;
9475
- const MutationsOverTimeGrid = ({ data, colorScale }) => {
9475
+ const MutationsOverTimeGrid = ({
9476
+ data,
9477
+ colorScale,
9478
+ maxNumberOfGridRows
9479
+ }) => {
9480
+ const currentMaxNumberOfGridRows = maxNumberOfGridRows ?? MAX_NUMBER_OF_GRID_ROWS;
9476
9481
  const allMutations = data.getFirstAxisKeys();
9477
- const shownMutations = allMutations.slice(0, MAX_NUMBER_OF_GRID_ROWS);
9482
+ const shownMutations = allMutations.slice(0, currentMaxNumberOfGridRows);
9478
9483
  const dates = data.getSecondAxisKeys();
9479
9484
  const gridRef = A$1(null);
9480
9485
  return /* @__PURE__ */ u$1(Fragment, { children: [
9481
- allMutations.length > MAX_NUMBER_OF_GRID_ROWS && /* @__PURE__ */ u$1("div", { className: "pl-2", children: [
9486
+ allMutations.length > currentMaxNumberOfGridRows && /* @__PURE__ */ u$1("div", { className: "pl-2", children: [
9482
9487
  "Showing ",
9483
- MAX_NUMBER_OF_GRID_ROWS,
9488
+ currentMaxNumberOfGridRows,
9484
9489
  " of ",
9485
9490
  allMutations.length,
9486
9491
  " mutations. You can narrow the filter to reduce the number of mutations."
@@ -11186,7 +11191,8 @@ const wastewaterMutationOverTimeSchema = z$2.object({
11186
11191
  lapisFilter: lapisFilterSchema,
11187
11192
  sequenceType: sequenceTypeSchema,
11188
11193
  width: z$2.string(),
11189
- height: z$2.string()
11194
+ height: z$2.string(),
11195
+ maxNumberOfGridRows: z$2.number().optional()
11190
11196
  });
11191
11197
  const WastewaterMutationsOverTime = (componentProps) => {
11192
11198
  const { width, height } = componentProps;
@@ -11220,18 +11226,20 @@ const WastewaterMutationsOverTimeInner = (componentProps) => {
11220
11226
  MutationsOverTimeTabs,
11221
11227
  {
11222
11228
  mutationOverTimeDataPerLocation,
11223
- originalComponentProps: componentProps
11229
+ originalComponentProps: componentProps,
11230
+ maxNumberOfGridRows: componentProps.maxNumberOfGridRows
11224
11231
  }
11225
11232
  );
11226
11233
  };
11227
11234
  const MutationsOverTimeTabs = ({
11228
11235
  mutationOverTimeDataPerLocation,
11229
- originalComponentProps
11236
+ originalComponentProps,
11237
+ maxNumberOfGridRows
11230
11238
  }) => {
11231
11239
  const [colorScale, setColorScale] = h({ min: 0, max: 1, color: "indigo" });
11232
11240
  const tabs = mutationOverTimeDataPerLocation.map(({ location, data }) => ({
11233
11241
  title: location,
11234
- content: /* @__PURE__ */ u$1(MutationsOverTimeGrid, { data, colorScale })
11242
+ content: /* @__PURE__ */ u$1(MutationsOverTimeGrid, { data, colorScale, maxNumberOfGridRows })
11235
11243
  }));
11236
11244
  const toolbar = /* @__PURE__ */ u$1(
11237
11245
  Toolbar,
@@ -11257,7 +11265,7 @@ const WastewaterMutationsOverTimeInfo = ({
11257
11265
  const lapis = x$1(LapisUrlContext);
11258
11266
  return /* @__PURE__ */ u$1(Info, { children: [
11259
11267
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Info for mutations over time" }),
11260
- /* @__PURE__ */ u$1(InfoParagraph, { children: " " }),
11268
+ /* @__PURE__ */ u$1(InfoParagraph, { children: /* @__PURE__ */ u$1("slot", { name: "infoText" }) }),
11261
11269
  /* @__PURE__ */ u$1(
11262
11270
  InfoComponentCode,
11263
11271
  {
@@ -11285,6 +11293,7 @@ let WastewaterMutationsOverTimeComponent = class extends PreactLitAdapterWithGri
11285
11293
  this.sequenceType = "nucleotide";
11286
11294
  this.width = "100%";
11287
11295
  this.height = "700px";
11296
+ this.maxNumberOfGridRows = 100;
11288
11297
  }
11289
11298
  render() {
11290
11299
  return /* @__PURE__ */ u$1(
@@ -11293,7 +11302,8 @@ let WastewaterMutationsOverTimeComponent = class extends PreactLitAdapterWithGri
11293
11302
  lapisFilter: this.lapisFilter,
11294
11303
  sequenceType: this.sequenceType,
11295
11304
  width: this.width,
11296
- height: this.height
11305
+ height: this.height,
11306
+ maxNumberOfGridRows: this.maxNumberOfGridRows
11297
11307
  }
11298
11308
  );
11299
11309
  }
@@ -11310,6 +11320,9 @@ __decorateClass$5([
11310
11320
  __decorateClass$5([
11311
11321
  n$1({ type: String })
11312
11322
  ], WastewaterMutationsOverTimeComponent.prototype, "height", 2);
11323
+ __decorateClass$5([
11324
+ n$1({ type: Number })
11325
+ ], WastewaterMutationsOverTimeComponent.prototype, "maxNumberOfGridRows", 2);
11313
11326
  WastewaterMutationsOverTimeComponent = __decorateClass$5([
11314
11327
  t$3("gs-wastewater-mutations-over-time")
11315
11328
  ], WastewaterMutationsOverTimeComponent);