@genspectrum/dashboard-components 0.1.5 → 0.2.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 +1013 -931
  2. package/dist/dashboard-components.js +350 -171
  3. package/dist/dashboard-components.js.map +1 -1
  4. package/dist/genspectrum-components.d.ts +48 -57
  5. package/dist/style.css +74 -23
  6. package/package.json +2 -2
  7. package/src/preact/aggregatedData/aggregate.tsx +28 -28
  8. package/src/preact/components/error-boundary.stories.tsx +62 -0
  9. package/src/preact/components/error-boundary.tsx +31 -0
  10. package/src/preact/components/error-display.stories.tsx +24 -3
  11. package/src/preact/components/error-display.tsx +14 -1
  12. package/src/preact/components/loading-display.stories.tsx +6 -6
  13. package/src/preact/components/loading-display.tsx +1 -1
  14. package/src/preact/components/no-data-display.tsx +5 -1
  15. package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +17 -0
  16. package/src/preact/dateRangeSelector/date-range-selector.tsx +33 -5
  17. package/src/preact/locationFilter/location-filter.stories.tsx +23 -6
  18. package/src/preact/locationFilter/location-filter.tsx +29 -18
  19. package/src/preact/mutationComparison/mutation-comparison.tsx +29 -25
  20. package/src/preact/mutationFilter/mutation-filter.stories.tsx +17 -2
  21. package/src/preact/mutationFilter/mutation-filter.tsx +25 -7
  22. package/src/preact/mutations/mutations.tsx +23 -23
  23. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +44 -28
  24. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +43 -31
  25. package/src/preact/textInput/text-input.tsx +26 -3
  26. package/src/web-components/app.stories.ts +1 -2
  27. package/src/web-components/app.ts +4 -2
  28. package/src/web-components/index.ts +1 -1
  29. package/src/web-components/input/{date-range-selector-component.stories.ts → gs-date-range-selector.stories.ts} +19 -2
  30. package/src/web-components/input/{date-range-selector-component.tsx → gs-date-range-selector.tsx} +12 -0
  31. package/src/web-components/input/{location-filter-component.stories.ts → gs-location-filter.stories.ts} +29 -4
  32. package/src/web-components/input/{location-filter-component.tsx → gs-location-filter.tsx} +12 -1
  33. package/src/web-components/input/{mutation-filter-component.stories.ts → gs-mutation-filter.stories.ts} +20 -4
  34. package/src/web-components/input/{mutation-filter-component.tsx → gs-mutation-filter.tsx} +36 -5
  35. package/src/web-components/input/{text-input-component.stories.ts → gs-text-input.stories.ts} +31 -3
  36. package/src/web-components/input/{text-input-component.tsx → gs-text-input.tsx} +12 -0
  37. package/src/web-components/input/index.ts +4 -4
  38. package/src/web-components/visualization/data_visualization_statistical_analysis.mdx +26 -0
  39. package/src/web-components/{display/aggregate-component.stories.ts → visualization/gs-aggregate.stories.ts} +5 -6
  40. package/src/web-components/{display/aggregate-component.tsx → visualization/gs-aggregate.tsx} +1 -1
  41. package/src/web-components/{display/mutation-comparison-component.stories.ts → visualization/gs-mutation-comparison.stories.ts} +8 -9
  42. package/src/web-components/{display/mutation-comparison-component.tsx → visualization/gs-mutation-comparison.tsx} +1 -1
  43. package/src/web-components/{display/mutations-component.stories.ts → visualization/gs-mutations.stories.ts} +6 -7
  44. package/src/web-components/{display/mutations-component.tsx → visualization/gs-mutations.tsx} +2 -2
  45. package/src/web-components/{display/prevalence-over-time-component.stories.ts → visualization/gs-prevalence-over-time.stories.ts} +1 -2
  46. package/src/web-components/{display/prevalence-over-time-component.tsx → visualization/gs-prevalence-over-time.tsx} +3 -1
  47. package/src/web-components/{display/relative-growth-advantage-component.stories.ts → visualization/gs-relative-growth-advantage.stories.ts} +1 -2
  48. package/src/web-components/visualization/index.ts +5 -0
  49. package/src/web-components/display/index.ts +0 -5
  50. /package/src/web-components/{display/relative-growth-advantage-component.tsx → visualization/gs-relative-growth-advantage.tsx} +0 -0
@@ -6,12 +6,12 @@ import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
6
6
  import aggregatedData from '../../preact/aggregatedData/__mockData__/aggregated.json';
7
7
  import type { AggregateProps } from '../../preact/aggregatedData/aggregate';
8
8
 
9
- import './aggregate-component';
9
+ import './gs-aggregate';
10
10
  import '../app';
11
11
 
12
12
  const meta: Meta<AggregateProps> = {
13
13
  title: 'Visualization/Aggregate',
14
- component: 'gs-aggregate-component',
14
+ component: 'gs-aggregate',
15
15
  argTypes: {
16
16
  fields: [{ control: 'object' }],
17
17
  views: {
@@ -41,10 +41,9 @@ const meta: Meta<AggregateProps> = {
41
41
  ],
42
42
  },
43
43
  componentDocs: {
44
- tag: 'gs-aggregate-component',
45
44
  opensShadowDom: true,
46
45
  expectsChildren: false,
47
- codeExample: `<gs-aggregate-component fields='["division", "host"]' filter='{"country": "USA"}' views='["table"]'></gs-aggregate-component>`,
46
+ codeExample: `<gs-aggregate fields='["division", "host"]' filter='{"country": "USA"}' views='["table"]'></gs-aggregate>`,
48
47
  },
49
48
  }),
50
49
  tags: ['autodocs'],
@@ -55,13 +54,13 @@ export default meta;
55
54
  export const Table: StoryObj<AggregateProps> = {
56
55
  render: (args) => html`
57
56
  <gs-app lapis="${LAPIS_URL}">
58
- <gs-aggregate-component
57
+ <gs-aggregate
59
58
  .fields=${args.fields}
60
59
  .filter=${args.filter}
61
60
  .views=${args.views}
62
61
  .size=${args.size}
63
62
  .headline=${args.headline}
64
- ></gs-aggregate-component>
63
+ ></gs-aggregate>
65
64
  </gs-app>
66
65
  `,
67
66
  args: {
@@ -11,7 +11,7 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
11
11
  *
12
12
  * It expects a list of fields to aggregate by and a filter to apply to the data.
13
13
  */
14
- @customElement('gs-aggregate-component')
14
+ @customElement('gs-aggregate')
15
15
  export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
16
16
  /**
17
17
  * The fields to aggregate by.
@@ -2,7 +2,7 @@ import { expect, fireEvent, waitFor } from '@storybook/test';
2
2
  import type { Meta, StoryObj } from '@storybook/web-components';
3
3
  import { html } from 'lit';
4
4
 
5
- import './mutation-comparison-component';
5
+ import './gs-mutation-comparison';
6
6
  import '../app';
7
7
  import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
8
8
  import { LAPIS_URL, NUCLEOTIDE_MUTATIONS_ENDPOINT } from '../../constants';
@@ -12,15 +12,15 @@ import { type MutationComparisonProps } from '../../preact/mutationComparison/mu
12
12
  import { withinShadowRoot } from '../withinShadowRoot.story';
13
13
 
14
14
  const codeExample = String.raw`
15
- <gs-mutation-comparison-component
15
+ <gs-mutation-comparison
16
16
  variants='[{ "displayName": "variant1", "lapisFilter": { "country": "Switzerland" }}, { "displayName": "variant2", "lapisFilter": { "country": "Germany" }}]'
17
17
  sequenceType="nucleotide"
18
18
  views='["table", "venn"]'
19
- ></gs-mutation-comparison-component>`;
19
+ ></gs-mutation-comparison>`;
20
20
 
21
21
  const meta: Meta<MutationComparisonProps> = {
22
22
  title: 'Visualization/Mutation comparison',
23
- component: 'gs-mutation-comparison-component',
23
+ component: 'gs-mutation-comparison',
24
24
  argTypes: {
25
25
  variants: { control: 'object' },
26
26
  sequenceType: {
@@ -36,7 +36,6 @@ const meta: Meta<MutationComparisonProps> = {
36
36
  },
37
37
  parameters: withComponentDocs({
38
38
  componentDocs: {
39
- tag: 'gs-mutation-comparison-component',
40
39
  opensShadowDom: true,
41
40
  expectsChildren: false,
42
41
  codeExample,
@@ -50,13 +49,13 @@ export default meta;
50
49
  const Template: StoryObj<MutationComparisonProps> = {
51
50
  render: (args) => html`
52
51
  <gs-app lapis="${LAPIS_URL}">
53
- <gs-mutation-comparison-component
52
+ <gs-mutation-comparison
54
53
  .variants=${args.variants}
55
54
  .sequenceType=${args.sequenceType}
56
55
  .views=${args.views}
57
56
  .size=${args.size}
58
57
  .headline=${args.headline}
59
- ></gs-mutation-comparison-component>
58
+ ></gs-mutation-comparison>
60
59
  </gs-app>
61
60
  `,
62
61
  };
@@ -127,7 +126,7 @@ export const Default: StoryObj<MutationComparisonProps> = {
127
126
  },
128
127
  },
129
128
  play: async ({ canvasElement, step }) => {
130
- const canvas = await withinShadowRoot(canvasElement, 'gs-mutation-comparison-component');
129
+ const canvas = await withinShadowRoot(canvasElement, 'gs-mutation-comparison');
131
130
 
132
131
  await step('Min and max proportions should be 50% and 100%', async () => {
133
132
  const minInput = () => canvas.getAllByLabelText('%')[0];
@@ -142,7 +141,7 @@ export const Default: StoryObj<MutationComparisonProps> = {
142
141
  export const VennDiagram: StoryObj<MutationComparisonProps> = {
143
142
  ...Default,
144
143
  play: async ({ canvasElement, step }) => {
145
- const canvas = await withinShadowRoot(canvasElement, 'gs-mutation-comparison-component');
144
+ const canvas = await withinShadowRoot(canvasElement, 'gs-mutation-comparison');
146
145
 
147
146
  await step('Switch to Venn diagram view', async () => {
148
147
  await waitFor(() => expect(canvas.getByRole('button', { name: 'Venn' })).toBeInTheDocument());
@@ -32,7 +32,7 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
32
32
  * Thus, changing the proportion interval may change a mutations from being "common" between variant
33
33
  * to being "for one variant only".
34
34
  */
35
- @customElement('gs-mutation-comparison-component')
35
+ @customElement('gs-mutation-comparison')
36
36
  export class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyles {
37
37
  /**
38
38
  * An array of variants to compare.
@@ -2,7 +2,7 @@ import { expect, fireEvent, waitFor } from '@storybook/test';
2
2
  import type { Meta, StoryObj } from '@storybook/web-components';
3
3
  import { html } from 'lit';
4
4
 
5
- import './mutations-component';
5
+ import './gs-mutations';
6
6
  import '../app';
7
7
  import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
8
8
  import { LAPIS_URL, NUCLEOTIDE_INSERTIONS_ENDPOINT, NUCLEOTIDE_MUTATIONS_ENDPOINT } from '../../constants';
@@ -20,7 +20,7 @@ const codeExample = String.raw`
20
20
 
21
21
  const meta: Meta<MutationsProps> = {
22
22
  title: 'Visualization/Mutations',
23
- component: 'gs-mutations-component',
23
+ component: 'gs-mutations',
24
24
  argTypes: {
25
25
  variant: { control: 'object' },
26
26
  sequenceType: {
@@ -43,7 +43,6 @@ const meta: Meta<MutationsProps> = {
43
43
  },
44
44
  parameters: withComponentDocs({
45
45
  componentDocs: {
46
- tag: 'gs-mutations-component',
47
46
  opensShadowDom: true,
48
47
  expectsChildren: false,
49
48
  codeExample,
@@ -57,13 +56,13 @@ export default meta;
57
56
  const Template: StoryObj<MutationsProps> = {
58
57
  render: (args) => html`
59
58
  <gs-app lapis="${LAPIS_URL}">
60
- <gs-mutations-component
59
+ <gs-mutations
61
60
  .variant=${args.variant}
62
61
  .sequenceType=${args.sequenceType}
63
62
  .views=${args.views}
64
63
  .size=${args.size}
65
64
  .headline=${args.headline}
66
- ></gs-mutations-component>
65
+ ></gs-mutations>
67
66
  </gs-app>
68
67
  `,
69
68
  };
@@ -108,7 +107,7 @@ export const Default: StoryObj<MutationsProps> = {
108
107
  export const OnTableTab: StoryObj<MutationsProps> = {
109
108
  ...Default,
110
109
  play: async ({ canvasElement }) => {
111
- const canvas = await withinShadowRoot(canvasElement, 'gs-mutations-component');
110
+ const canvas = await withinShadowRoot(canvasElement, 'gs-mutations');
112
111
 
113
112
  await waitFor(() => expect(canvas.getByRole('button', { name: 'Table' })).toBeInTheDocument());
114
113
 
@@ -119,7 +118,7 @@ export const OnTableTab: StoryObj<MutationsProps> = {
119
118
  export const OnInsertionsTab: StoryObj<MutationsProps> = {
120
119
  ...Default,
121
120
  play: async ({ canvasElement }) => {
122
- const canvas = await withinShadowRoot(canvasElement, 'gs-mutations-component');
121
+ const canvas = await withinShadowRoot(canvasElement, 'gs-mutations');
123
122
 
124
123
  await waitFor(() => expect(canvas.getByRole('button', { name: 'Insertions' })).toBeInTheDocument());
125
124
 
@@ -30,14 +30,14 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
30
30
  * The insertions view shows the count of all insertions for the given variant.
31
31
  *
32
32
  */
33
- @customElement('gs-mutations-component')
33
+ @customElement('gs-mutations')
34
34
  export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
35
35
  /**
36
36
  * The `variant` will be sent as is to LAPIS to filter the mutation data.
37
37
  * It must be a valid LAPIS filter object.
38
38
  */
39
39
  @property({ type: Object })
40
- variant: Record<string, string | number | null | boolean> = { displayName: '' };
40
+ variant: Record<string, string | number | null | boolean> = {};
41
41
 
42
42
  /**
43
43
  * The type of the sequence for which the mutations should be shown.
@@ -3,7 +3,7 @@ import type { Meta, StoryObj } from '@storybook/web-components';
3
3
  import { html } from 'lit';
4
4
 
5
5
  import '../app';
6
- import './prevalence-over-time-component';
6
+ import './gs-prevalence-over-time';
7
7
  import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
8
8
  import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
9
9
  import denominator from '../../preact/prevalenceOverTime/__mockData__/denominator.json';
@@ -48,7 +48,6 @@ const meta: Meta<PrevalenceOverTimeProps> = {
48
48
  },
49
49
  parameters: withComponentDocs({
50
50
  componentDocs: {
51
- tag: 'gs-prevalence-over-time',
52
51
  opensShadowDom: true,
53
52
  expectsChildren: false,
54
53
  codeExample,
@@ -43,6 +43,8 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
43
43
  */
44
44
  @customElement('gs-prevalence-over-time')
45
45
  export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyles {
46
+ // prettier-ignore
47
+ // The multiline union type must not start with `|` because it looks weird in the Storybook docs
46
48
  /**
47
49
  * Either a single variant or an array of variants to compare.
48
50
  * This must be a valid LAPIS filter object with an additional `displayName` property
@@ -51,7 +53,7 @@ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyle
51
53
  */
52
54
  @property({ type: Object })
53
55
  numerator:
54
- | (Record<string, string | number | null | boolean> & { displayName: string })
56
+ (Record<string, string | number | null | boolean> & { displayName: string })
55
57
  | (Record<string, string | number | null | boolean> & {
56
58
  displayName: string;
57
59
  })[] = { displayName: '' };
@@ -1,7 +1,7 @@
1
1
  import type { Meta, StoryObj } from '@storybook/web-components';
2
2
  import { html } from 'lit';
3
3
 
4
- import './relative-growth-advantage-component';
4
+ import './gs-relative-growth-advantage';
5
5
  import '../app';
6
6
  import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
7
7
  import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
@@ -33,7 +33,6 @@ const meta: Meta<RelativeGrowthAdvantageProps> = {
33
33
  },
34
34
  parameters: withComponentDocs({
35
35
  componentDocs: {
36
- tag: 'gs-relative-growth-advantage',
37
36
  opensShadowDom: true,
38
37
  expectsChildren: false,
39
38
  codeExample,
@@ -0,0 +1,5 @@
1
+ export { MutationComparisonComponent } from './gs-mutation-comparison';
2
+ export { MutationsComponent } from './gs-mutations';
3
+ export { PrevalenceOverTimeComponent } from './gs-prevalence-over-time';
4
+ export { RelativeGrowthAdvantageComponent } from './gs-relative-growth-advantage';
5
+ export { AggregateComponent } from './gs-aggregate';
@@ -1,5 +0,0 @@
1
- export { MutationComparisonComponent } from './mutation-comparison-component';
2
- export { MutationsComponent } from './mutations-component';
3
- export { PrevalenceOverTimeComponent } from './prevalence-over-time-component';
4
- export { RelativeGrowthAdvantageComponent } from './relative-growth-advantage-component';
5
- export { AggregateComponent } from './aggregate-component';