@genspectrum/dashboard-components 0.17.0 → 0.18.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 (50) hide show
  1. package/custom-elements.json +47 -16
  2. package/dist/components.d.ts +21 -17
  3. package/dist/components.js +426 -3654
  4. package/dist/components.js.map +1 -1
  5. package/dist/style.css +2 -3375
  6. package/dist/util.d.ts +15 -15
  7. package/package.json +6 -5
  8. package/src/preact/aggregatedData/aggregate.tsx +3 -3
  9. package/src/preact/components/clearable-select.tsx +1 -1
  10. package/src/preact/components/color-scale-selector-dropdown.tsx +1 -1
  11. package/src/preact/components/confidence-interval-selector.tsx +1 -1
  12. package/src/preact/components/downshift-combobox.tsx +3 -3
  13. package/src/preact/components/fullscreen.tsx +6 -2
  14. package/src/preact/components/info.tsx +1 -1
  15. package/src/preact/components/mutation-type-selector.tsx +1 -1
  16. package/src/preact/components/percent-intput.tsx +3 -3
  17. package/src/preact/components/proportion-selector-dropdown.tsx +1 -1
  18. package/src/preact/components/scaling-selector.tsx +1 -1
  19. package/src/preact/components/select.tsx +1 -1
  20. package/src/preact/components/tabs.tsx +1 -1
  21. package/src/preact/dateRangeFilter/date-picker.tsx +1 -1
  22. package/src/preact/dateRangeFilter/date-range-filter.tsx +4 -4
  23. package/src/preact/mutationComparison/mutation-comparison.tsx +1 -1
  24. package/src/preact/mutations/mutations.tsx +2 -2
  25. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +133 -84
  26. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +46 -16
  27. package/src/preact/mutationsOverTime/mutations-over-time.tsx +4 -1
  28. package/src/preact/numberSequencesOverTime/number-sequences-over-time.tsx +1 -1
  29. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +1 -1
  30. package/src/preact/sequencesByLocation/sequences-by-location-map.tsx +1 -1
  31. package/src/preact/sequencesByLocation/sequences-by-location.tsx +3 -7
  32. package/src/preact/shared/tanstackTable/pagination.tsx +132 -0
  33. package/src/preact/shared/tanstackTable/tanstackTable.tsx +43 -0
  34. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.stories.tsx +2 -1
  35. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +3 -5
  36. package/src/styles/tailwind.css +14 -3
  37. package/src/web-components/input/gs-date-range-filter.stories.ts +2 -2
  38. package/src/web-components/input/gs-lineage-filter.stories.ts +1 -1
  39. package/src/web-components/input/gs-location-filter.stories.ts +1 -1
  40. package/src/web-components/input/gs-mutation-filter.stories.ts +1 -1
  41. package/src/web-components/input/gs-text-filter.stories.ts +1 -1
  42. package/src/web-components/visualization/gs-mutations-over-time.spec-d.ts +39 -0
  43. package/src/web-components/visualization/gs-mutations-over-time.stories.ts +4 -0
  44. package/src/web-components/visualization/gs-mutations-over-time.tsx +8 -31
  45. package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.spec-d.ts +24 -0
  46. package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.stories.ts +3 -3
  47. package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.tsx +5 -36
  48. package/standalone-bundle/dashboard-components.js +17318 -15507
  49. package/standalone-bundle/dashboard-components.js.map +1 -1
  50. package/standalone-bundle/style.css +1 -1
@@ -16,6 +16,7 @@ import { ResizeContainer } from '../../components/resize-container';
16
16
  import Tabs from '../../components/tabs';
17
17
  import { type MutationOverTimeDataMap } from '../../mutationsOverTime/MutationOverTimeData';
18
18
  import MutationsOverTimeGrid from '../../mutationsOverTime/mutations-over-time-grid';
19
+ import { pageSizesSchema } from '../../shared/tanstackTable/pagination';
19
20
  import { useQuery } from '../../useQuery';
20
21
 
21
22
  const wastewaterMutationOverTimeSchema = z.object({
@@ -23,7 +24,7 @@ const wastewaterMutationOverTimeSchema = z.object({
23
24
  sequenceType: sequenceTypeSchema,
24
25
  width: z.string(),
25
26
  height: z.string().optional(),
26
- maxNumberOfGridRows: z.number(),
27
+ pageSizes: pageSizesSchema,
27
28
  });
28
29
 
29
30
  export type WastewaterMutationsOverTimeProps = z.infer<typeof wastewaterMutationOverTimeSchema>;
@@ -76,7 +77,6 @@ export const WastewaterMutationsOverTimeInner: FunctionComponent<WastewaterMutat
76
77
  <MutationsOverTimeTabs
77
78
  mutationOverTimeDataPerLocation={mutationOverTimeDataPerLocation}
78
79
  originalComponentProps={componentProps}
79
- maxNumberOfGridRows={componentProps.maxNumberOfGridRows}
80
80
  />
81
81
  );
82
82
  };
@@ -89,13 +89,11 @@ type MutationOverTimeDataPerLocation = {
89
89
  type MutationOverTimeTabsProps = {
90
90
  mutationOverTimeDataPerLocation: MutationOverTimeDataPerLocation;
91
91
  originalComponentProps: WastewaterMutationsOverTimeProps;
92
- maxNumberOfGridRows?: number;
93
92
  };
94
93
 
95
94
  const MutationsOverTimeTabs: FunctionComponent<MutationOverTimeTabsProps> = ({
96
95
  mutationOverTimeDataPerLocation,
97
96
  originalComponentProps,
98
- maxNumberOfGridRows,
99
97
  }) => {
100
98
  const [colorScale, setColorScale] = useState<ColorScale>({ min: 0, max: 1, color: 'indigo' });
101
99
 
@@ -105,7 +103,7 @@ const MutationsOverTimeTabs: FunctionComponent<MutationOverTimeTabsProps> = ({
105
103
  <MutationsOverTimeGrid
106
104
  data={data}
107
105
  colorScale={colorScale}
108
- maxNumberOfGridRows={maxNumberOfGridRows}
106
+ pageSizes={originalComponentProps.pageSizes}
109
107
  sequenceType={originalComponentProps.sequenceType}
110
108
  />
111
109
  ),
@@ -1,3 +1,14 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
1
+ @import 'tailwindcss';
2
+
3
+ @plugin "daisyui" {
4
+ themes: light --default;
5
+ }
6
+ @plugin "@iconify/tailwind4" {
7
+ prefixes: mdi, mdi-light;
8
+ }
9
+
10
+ @theme {
11
+ --container-2xs: 18rem;
12
+ --container-3xs: 16rem;
13
+ --container-4xs: 14rem;
14
+ }
@@ -78,7 +78,7 @@ export default meta;
78
78
  export const Default: StoryObj<Required<DateRangeFilterProps>> = {
79
79
  render: (args) =>
80
80
  html` <gs-app lapis="${LAPIS_URL}">
81
- <div class="max-w-screen-lg">
81
+ <div class="max-w-(--breakpoint-lg)">
82
82
  <gs-date-range-filter
83
83
  .dateRangeOptions=${args.dateRangeOptions}
84
84
  .earliestDate=${args.earliestDate}
@@ -94,7 +94,7 @@ export const Default: StoryObj<Required<DateRangeFilterProps>> = {
94
94
  export const TestRenderAttributesInHtmlInsteadOfUsingPropertyExpression: StoryObj<Required<DateRangeFilterProps>> = {
95
95
  render: (args) =>
96
96
  html` <gs-app lapis="${LAPIS_URL}">
97
- <div class="max-w-screen-lg">
97
+ <div class="max-w-(--breakpoint-lg)">
98
98
  <gs-date-range-filter
99
99
  .dateRangeOptions=${args.dateRangeOptions}
100
100
  earliestDate="${args.earliestDate}"
@@ -87,7 +87,7 @@ export default meta;
87
87
  const Template: StoryObj<Required<LineageFilterProps>> = {
88
88
  render: (args) => {
89
89
  return html` <gs-app lapis="${LAPIS_URL}">
90
- <div class="max-w-screen-lg">
90
+ <div class="max-w-(--breakpoint-lg)">
91
91
  <gs-lineage-filter
92
92
  .lapisField=${args.lapisField}
93
93
  .lapisFilter=${args.lapisFilter}
@@ -67,7 +67,7 @@ export default meta;
67
67
  const Template: StoryObj<LocationFilterProps> = {
68
68
  render: (args) => {
69
69
  return html` <gs-app lapis="${LAPIS_URL}">
70
- <div class="max-w-screen-lg">
70
+ <div class="max-w-(--breakpoint-lg)">
71
71
  <gs-location-filter
72
72
  .fields=${args.fields}
73
73
  .lapisFilter=${args.lapisFilter}
@@ -46,7 +46,7 @@ export default meta;
46
46
  const Template: StoryObj<MutationFilterProps> = {
47
47
  render: (args) => {
48
48
  return html` <gs-app lapis="${LAPIS_URL}">
49
- <div class="max-w-screen-lg">
49
+ <div class="max-w-(--breakpoint-lg)">
50
50
  <gs-mutation-filter .initialValue=${args.initialValue} .width=${args.width}></gs-mutation-filter>
51
51
  </div>
52
52
  </gs-app>`;
@@ -86,7 +86,7 @@ export default meta;
86
86
  export const Default: StoryObj<Required<TextFilterProps>> = {
87
87
  render: (args) => {
88
88
  return html` <gs-app lapis="${LAPIS_URL}">
89
- <div class="max-w-screen-lg">
89
+ <div class="max-w-(--breakpoint-lg)">
90
90
  <gs-text-filter
91
91
  .lapisField=${args.lapisField}
92
92
  .lapisFilter=${args.lapisFilter}
@@ -0,0 +1,39 @@
1
+ import { describe, expectTypeOf, it } from 'vitest';
2
+
3
+ import { type MutationsOverTimeComponent } from './gs-mutations-over-time';
4
+ import { type MutationsOverTimeProps } from '../../preact/mutationsOverTime/mutations-over-time';
5
+
6
+ describe('gs-mutations-over-time', () => {
7
+ it('types of preact and lit component should match', () => {
8
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.lapisFilter>().toEqualTypeOf<
9
+ MutationsOverTimeProps['lapisFilter']
10
+ >();
11
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.sequenceType>().toEqualTypeOf<
12
+ MutationsOverTimeProps['sequenceType']
13
+ >();
14
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.views>().toEqualTypeOf<
15
+ MutationsOverTimeProps['views']
16
+ >();
17
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.width>().toEqualTypeOf<
18
+ MutationsOverTimeProps['width']
19
+ >();
20
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.height>().toEqualTypeOf<
21
+ MutationsOverTimeProps['height']
22
+ >();
23
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.granularity>().toEqualTypeOf<
24
+ MutationsOverTimeProps['granularity']
25
+ >();
26
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.lapisDateField>().toEqualTypeOf<
27
+ MutationsOverTimeProps['lapisDateField']
28
+ >();
29
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.displayMutations>().toEqualTypeOf<
30
+ MutationsOverTimeProps['displayMutations']
31
+ >();
32
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.initialMeanProportionInterval>().toEqualTypeOf<
33
+ MutationsOverTimeProps['initialMeanProportionInterval']
34
+ >();
35
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.pageSizes>().toEqualTypeOf<
36
+ MutationsOverTimeProps['pageSizes']
37
+ >();
38
+ });
39
+ });
@@ -17,6 +17,7 @@ const codeExample = String.raw`
17
17
  granularity="month"
18
18
  lapisDateField="date"
19
19
  displayMutations='["A23403G","C241T"]'
20
+ pageSizes='[5,10]'
20
21
  ></gs-mutations-over-time>`;
21
22
 
22
23
  const meta: Meta<Required<MutationsOverTimeProps>> = {
@@ -41,6 +42,7 @@ const meta: Meta<Required<MutationsOverTimeProps>> = {
41
42
  lapisDateField: { control: 'text' },
42
43
  displayMutations: { control: 'object' },
43
44
  initialMeanProportionInterval: { control: 'object' },
45
+ pageSizes: { control: 'object' },
44
46
  },
45
47
  args: {
46
48
  lapisFilter: { pangoLineage: 'JN.1*', dateFrom: '2024-01-15', dateTo: '2024-07-10' },
@@ -50,6 +52,7 @@ const meta: Meta<Required<MutationsOverTimeProps>> = {
50
52
  granularity: 'month',
51
53
  lapisDateField: 'date',
52
54
  initialMeanProportionInterval: { min: 0.05, max: 0.9 },
55
+ pageSizes: [10, 20, 30, 40, 50],
53
56
  },
54
57
  parameters: withComponentDocs({
55
58
  componentDocs: {
@@ -95,6 +98,7 @@ const Template: StoryObj<Required<MutationsOverTimeProps>> = {
95
98
  .lapisDateField=${args.lapisDateField}
96
99
  .displayMutations=${args.displayMutations}
97
100
  .initialMeanProportionInterval=${args.initialMeanProportionInterval}
101
+ .pageSizes=${args.pageSizes}
98
102
  ></gs-mutations-over-time>
99
103
  </gs-app>
100
104
  `,
@@ -3,8 +3,7 @@ import { customElement, property } from 'lit/decorators.js';
3
3
  import type { DetailedHTMLProps, HTMLAttributes } from 'react';
4
4
 
5
5
  import { MutationAnnotationsContextProvider } from '../../preact/MutationAnnotationsContext';
6
- import { MutationsOverTime, type MutationsOverTimeProps } from '../../preact/mutationsOverTime/mutations-over-time';
7
- import type { Equals, Expect } from '../../utils/typeAssertions';
6
+ import { MutationsOverTime } from '../../preact/mutationsOverTime/mutations-over-time';
8
7
  import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
9
8
  import { type MutationAnnotations, mutationAnnotationsContext } from '../mutation-annotations-context';
10
9
 
@@ -111,6 +110,12 @@ export class MutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles
111
110
  @property({ type: Object })
112
111
  initialMeanProportionInterval: { min: number; max: number } = { min: 0.05, max: 0.9 };
113
112
 
113
+ /**
114
+ * The number of rows per page, which can be selected by the user.
115
+ */
116
+ @property({ type: Array })
117
+ pageSizes: number[] | number = [10, 20, 30, 40, 50];
118
+
114
119
  /**
115
120
  * @internal
116
121
  */
@@ -130,6 +135,7 @@ export class MutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles
130
135
  lapisDateField={this.lapisDateField}
131
136
  displayMutations={this.displayMutations}
132
137
  initialMeanProportionInterval={this.initialMeanProportionInterval}
138
+ pageSizes={this.pageSizes}
133
139
  />
134
140
  </MutationAnnotationsContextProvider>
135
141
  );
@@ -150,32 +156,3 @@ declare global {
150
156
  }
151
157
  }
152
158
  }
153
-
154
- /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
155
- type LapisFilterMatches = Expect<
156
- Equals<typeof MutationsOverTimeComponent.prototype.lapisFilter, MutationsOverTimeProps['lapisFilter']>
157
- >;
158
- type SequenceTypeMatches = Expect<
159
- Equals<typeof MutationsOverTimeComponent.prototype.sequenceType, MutationsOverTimeProps['sequenceType']>
160
- >;
161
- type ViewsMatches = Expect<Equals<typeof MutationsOverTimeComponent.prototype.views, MutationsOverTimeProps['views']>>;
162
- type WidthMatches = Expect<Equals<typeof MutationsOverTimeComponent.prototype.width, MutationsOverTimeProps['width']>>;
163
- type HeightMatches = Expect<
164
- Equals<typeof MutationsOverTimeComponent.prototype.height, MutationsOverTimeProps['height']>
165
- >;
166
- type GranularityMatches = Expect<
167
- Equals<typeof MutationsOverTimeComponent.prototype.granularity, MutationsOverTimeProps['granularity']>
168
- >;
169
- type LapisDateFieldMatches = Expect<
170
- Equals<typeof MutationsOverTimeComponent.prototype.lapisDateField, MutationsOverTimeProps['lapisDateField']>
171
- >;
172
- type DisplayMutationsMatches = Expect<
173
- Equals<typeof MutationsOverTimeComponent.prototype.displayMutations, MutationsOverTimeProps['displayMutations']>
174
- >;
175
- type InitialMeanProportionIntervalMatches = Expect<
176
- Equals<
177
- typeof MutationsOverTimeComponent.prototype.initialMeanProportionInterval,
178
- MutationsOverTimeProps['initialMeanProportionInterval']
179
- >
180
- >;
181
- /* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
@@ -0,0 +1,24 @@
1
+ import { describe, expectTypeOf, it } from 'vitest';
2
+
3
+ import { type WastewaterMutationsOverTimeComponent } from './gs-wastewater-mutations-over-time';
4
+ import { type WastewaterMutationsOverTimeProps } from '../../preact/wastewater/mutationsOverTime/wastewater-mutations-over-time';
5
+
6
+ describe('gs-wastewater-mutations-over-time', () => {
7
+ it('types of preact and lit component should match', () => {
8
+ expectTypeOf<typeof WastewaterMutationsOverTimeComponent.prototype.lapisFilter>().toEqualTypeOf<
9
+ WastewaterMutationsOverTimeProps['lapisFilter']
10
+ >();
11
+ expectTypeOf<typeof WastewaterMutationsOverTimeComponent.prototype.sequenceType>().toEqualTypeOf<
12
+ WastewaterMutationsOverTimeProps['sequenceType']
13
+ >();
14
+ expectTypeOf<typeof WastewaterMutationsOverTimeComponent.prototype.width>().toEqualTypeOf<
15
+ WastewaterMutationsOverTimeProps['width']
16
+ >();
17
+ expectTypeOf<typeof WastewaterMutationsOverTimeComponent.prototype.height>().toEqualTypeOf<
18
+ WastewaterMutationsOverTimeProps['height']
19
+ >();
20
+ expectTypeOf<typeof WastewaterMutationsOverTimeComponent.prototype.pageSizes>().toEqualTypeOf<
21
+ WastewaterMutationsOverTimeProps['pageSizes']
22
+ >();
23
+ });
24
+ });
@@ -14,7 +14,7 @@ const codeExample = String.raw`
14
14
  sequenceType='nucleotide'
15
15
  width='100%'
16
16
  height='700px'
17
- maxNumberOfGridRows='100'
17
+ pageSizes='[5,10]'
18
18
  >
19
19
  <span slot="infoText">Some info text</span>
20
20
  </gs-wastewater-mutations-over-time>`;
@@ -37,7 +37,7 @@ const meta: Meta<WastewaterMutationsOverTimeProps & { infoText: string }> = {
37
37
  width: '100%',
38
38
  height: undefined,
39
39
  infoText: 'Some info text',
40
- maxNumberOfGridRows: 100,
40
+ pageSizes: [10, 20, 30, 40, 50],
41
41
  },
42
42
  parameters: withComponentDocs({
43
43
  componentDocs: {
@@ -70,7 +70,7 @@ export const WastewaterMutationsOverTime: StoryObj<WastewaterMutationsOverTimePr
70
70
  .sequenceType=${args.sequenceType}
71
71
  .width=${args.width}
72
72
  .height=${args.height}
73
- .maxNumberOfGridRows=${args.maxNumberOfGridRows}
73
+ .pageSizes=${args.pageSizes}
74
74
  >
75
75
  <span slot="infoText">${args.infoText}</span>
76
76
  </gs-wastewater-mutations-over-time>
@@ -3,11 +3,7 @@ import { customElement, property } from 'lit/decorators.js';
3
3
  import { type DetailedHTMLProps, type HTMLAttributes } from 'react';
4
4
 
5
5
  import { MutationAnnotationsContextProvider } from '../../preact/MutationAnnotationsContext';
6
- import {
7
- WastewaterMutationsOverTime,
8
- type WastewaterMutationsOverTimeProps,
9
- } from '../../preact/wastewater/mutationsOverTime/wastewater-mutations-over-time';
10
- import { type Equals, type Expect } from '../../utils/typeAssertions';
6
+ import { WastewaterMutationsOverTime } from '../../preact/wastewater/mutationsOverTime/wastewater-mutations-over-time';
11
7
  import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
12
8
  import { type MutationAnnotations, mutationAnnotationsContext } from '../mutation-annotations-context';
13
9
 
@@ -69,10 +65,10 @@ export class WastewaterMutationsOverTimeComponent extends PreactLitAdapterWithGr
69
65
  height: string | undefined = undefined;
70
66
 
71
67
  /**
72
- * The maximum number of grid rows to display.
68
+ * The number of rows per page, which can be selected by the user.
73
69
  */
74
- @property({ type: Number })
75
- maxNumberOfGridRows: number = 100;
70
+ @property({ type: Array })
71
+ pageSizes: number[] | number = [10, 20, 30, 40, 50];
76
72
 
77
73
  /**
78
74
  * @internal
@@ -88,7 +84,7 @@ export class WastewaterMutationsOverTimeComponent extends PreactLitAdapterWithGr
88
84
  sequenceType={this.sequenceType}
89
85
  width={this.width}
90
86
  height={this.height}
91
- maxNumberOfGridRows={this.maxNumberOfGridRows}
87
+ pageSizes={this.pageSizes}
92
88
  />
93
89
  </MutationAnnotationsContextProvider>
94
90
  );
@@ -109,30 +105,3 @@ declare global {
109
105
  }
110
106
  }
111
107
  }
112
-
113
- /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
114
- type LapisFilterMatches = Expect<
115
- Equals<
116
- typeof WastewaterMutationsOverTimeComponent.prototype.lapisFilter,
117
- WastewaterMutationsOverTimeProps['lapisFilter']
118
- >
119
- >;
120
- type SequenceTypeMatches = Expect<
121
- Equals<
122
- typeof WastewaterMutationsOverTimeComponent.prototype.sequenceType,
123
- WastewaterMutationsOverTimeProps['sequenceType']
124
- >
125
- >;
126
- type WidthMatches = Expect<
127
- Equals<typeof WastewaterMutationsOverTimeComponent.prototype.width, WastewaterMutationsOverTimeProps['width']>
128
- >;
129
- type HeightMatches = Expect<
130
- Equals<typeof WastewaterMutationsOverTimeComponent.prototype.height, WastewaterMutationsOverTimeProps['height']>
131
- >;
132
- type MaxNumberOfGridRowsMatches = Expect<
133
- Equals<
134
- typeof WastewaterMutationsOverTimeComponent.prototype.maxNumberOfGridRows,
135
- WastewaterMutationsOverTimeProps['maxNumberOfGridRows']
136
- >
137
- >;
138
- /* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */