@genspectrum/dashboard-components 0.2.0 → 0.3.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 (58) hide show
  1. package/custom-elements.json +328 -177
  2. package/dist/dashboard-components.js +376 -129
  3. package/dist/dashboard-components.js.map +1 -1
  4. package/dist/genspectrum-components.d.ts +156 -110
  5. package/dist/style.css +179 -33
  6. package/package.json +1 -2
  7. package/src/constants.ts +1 -1
  8. package/src/lapisApi/lapisApi.ts +46 -2
  9. package/src/lapisApi/lapisTypes.ts +14 -0
  10. package/src/preact/aggregatedData/aggregate.stories.tsx +4 -2
  11. package/src/preact/aggregatedData/aggregate.tsx +8 -6
  12. package/src/preact/components/error-boundary.stories.tsx +6 -14
  13. package/src/preact/components/error-boundary.tsx +2 -11
  14. package/src/preact/components/error-display.stories.tsx +12 -5
  15. package/src/preact/components/error-display.tsx +37 -3
  16. package/src/preact/components/loading-display.stories.tsx +1 -1
  17. package/src/preact/components/resize-container.tsx +5 -14
  18. package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +2 -0
  19. package/src/preact/dateRangeSelector/date-range-selector.tsx +11 -8
  20. package/src/preact/locationFilter/fetchAutocompletionList.ts +15 -1
  21. package/src/preact/locationFilter/location-filter.tsx +4 -5
  22. package/src/preact/mutationComparison/mutation-comparison.stories.tsx +6 -3
  23. package/src/preact/mutationComparison/mutation-comparison.tsx +10 -13
  24. package/src/preact/mutationComparison/queryMutationData.ts +2 -3
  25. package/src/preact/mutationFilter/mutation-filter.stories.tsx +8 -8
  26. package/src/preact/mutationFilter/mutation-filter.tsx +7 -6
  27. package/src/preact/mutations/mutations.stories.tsx +6 -3
  28. package/src/preact/mutations/mutations.tsx +8 -6
  29. package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +14 -7
  30. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +10 -8
  31. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +6 -3
  32. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +9 -7
  33. package/src/preact/textInput/text-input.stories.tsx +26 -0
  34. package/src/preact/textInput/text-input.tsx +4 -5
  35. package/src/query/queryPrevalenceOverTime.ts +4 -10
  36. package/src/types.ts +4 -1
  37. package/src/web-components/ResizeContainer.mdx +13 -0
  38. package/src/web-components/app.ts +3 -1
  39. package/src/web-components/input/gs-date-range-selector.stories.ts +10 -2
  40. package/src/web-components/input/gs-date-range-selector.tsx +26 -16
  41. package/src/web-components/input/gs-location-filter.stories.ts +5 -3
  42. package/src/web-components/input/gs-location-filter.tsx +5 -6
  43. package/src/web-components/input/gs-mutation-filter.stories.ts +11 -8
  44. package/src/web-components/input/gs-mutation-filter.tsx +38 -26
  45. package/src/web-components/input/gs-text-input.stories.ts +3 -3
  46. package/src/web-components/input/gs-text-input.tsx +10 -10
  47. package/src/web-components/input/introduction.mdx +11 -0
  48. package/src/web-components/introduction.mdx +15 -0
  49. package/src/web-components/visualization/gs-aggregate.stories.ts +19 -6
  50. package/src/web-components/visualization/gs-aggregate.tsx +31 -15
  51. package/src/web-components/visualization/gs-mutation-comparison.stories.ts +13 -7
  52. package/src/web-components/visualization/gs-mutation-comparison.tsx +26 -17
  53. package/src/web-components/visualization/gs-mutations.stories.ts +14 -8
  54. package/src/web-components/visualization/gs-mutations.tsx +18 -8
  55. package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +28 -18
  56. package/src/web-components/visualization/gs-prevalence-over-time.tsx +45 -22
  57. package/src/web-components/visualization/gs-relative-growth-advantage.stories.ts +11 -5
  58. package/src/web-components/visualization/gs-relative-growth-advantage.tsx +21 -9
@@ -15,6 +15,9 @@ const codeExample = String.raw`
15
15
  denominator='{ "country": "Switzerland", "dateFrom": "2020-12-01" }'
16
16
  generationTime="7"
17
17
  views='["line"]'
18
+ width='100%'
19
+ height='700px'
20
+ headline="Relative growth advantage"
18
21
  ></gs-relative-growth-advantage>`;
19
22
 
20
23
  const meta: Meta<RelativeGrowthAdvantageProps> = {
@@ -28,7 +31,8 @@ const meta: Meta<RelativeGrowthAdvantageProps> = {
28
31
  options: ['line'],
29
32
  control: { type: 'check' },
30
33
  },
31
- size: [{ control: 'object' }],
34
+ width: { control: 'text' },
35
+ height: { control: 'text' },
32
36
  headline: { control: 'text' },
33
37
  },
34
38
  parameters: withComponentDocs({
@@ -43,7 +47,7 @@ const meta: Meta<RelativeGrowthAdvantageProps> = {
43
47
 
44
48
  export default meta;
45
49
 
46
- const Template: StoryObj<RelativeGrowthAdvantageProps> = {
50
+ const Template: StoryObj<Required<RelativeGrowthAdvantageProps>> = {
47
51
  render: (args) => html`
48
52
  <gs-app lapis="${LAPIS_URL}">
49
53
  <gs-relative-growth-advantage
@@ -51,21 +55,23 @@ const Template: StoryObj<RelativeGrowthAdvantageProps> = {
51
55
  .denominator=${args.denominator}
52
56
  .generationTime=${args.generationTime}
53
57
  .views=${args.views}
54
- .size=${args.size}
58
+ .width=${args.width}
59
+ .height=${args.height}
55
60
  .headline=${args.headline}
56
61
  ></gs-relative-growth-advantage>
57
62
  </gs-app>
58
63
  `,
59
64
  };
60
65
 
61
- export const Default: StoryObj<RelativeGrowthAdvantageProps> = {
66
+ export const Default: StoryObj<Required<RelativeGrowthAdvantageProps>> = {
62
67
  ...Template,
63
68
  args: {
64
69
  numerator: { country: 'Switzerland', pangoLineage: 'B.1.1.7', dateFrom: '2020-12-01', dateTo: '2021-03-01' },
65
70
  denominator: { country: 'Switzerland', dateFrom: '2020-12-01', dateTo: '2021-03-01' },
66
71
  generationTime: 7,
67
72
  views: ['line'],
68
- size: { width: '100%', height: '700px' },
73
+ width: '100%',
74
+ height: '700px',
69
75
  headline: 'Relative growth advantage',
70
76
  },
71
77
  parameters: {
@@ -6,7 +6,9 @@ import { type Equals, type Expect } from '../../utils/typeAssertions';
6
6
  import { PreactLitAdapter } from '../PreactLitAdapter';
7
7
 
8
8
  /**
9
- * We assume a discrete time model, where new infections happen exactly every `generationTime` days.
9
+ * ## Context
10
+ *
11
+ * For this component, we assume a discrete time model, where new infections happen exactly every `generationTime` days.
10
12
  * This is what we call a "generation".
11
13
  *
12
14
  * This component estimates the relative growth advantage of a variant by performing a logistic regression.
@@ -32,12 +34,16 @@ import { PreactLitAdapter } from '../PreactLitAdapter';
32
34
  @customElement('gs-relative-growth-advantage')
33
35
  export class RelativeGrowthAdvantageComponent extends PreactLitAdapter {
34
36
  /**
37
+ * Required.
38
+ *
35
39
  * The LAPIS filter for the focal variant.
36
40
  */
37
41
  @property({ type: Object })
38
42
  numerator: Record<string, string | number | null | boolean> = {};
39
43
 
40
44
  /**
45
+ * Required.
46
+ *
41
47
  * The LAPIS filter for the variant that the focal variant (`numerator`) should be compared to.
42
48
  */
43
49
  @property({ type: Object })
@@ -60,18 +66,23 @@ export class RelativeGrowthAdvantageComponent extends PreactLitAdapter {
60
66
  * The headline of the component. Set to an empty string to hide the headline.
61
67
  */
62
68
  @property({ type: String })
63
- headline: string | undefined = 'Relative growth advantage';
69
+ headline: string = 'Relative growth advantage';
64
70
 
65
71
  /**
66
- * The size of the component.
72
+ * The width of the component.
67
73
  *
68
- * If not set, the component will take the full width of its container with height 700px.
74
+ * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
75
+ */
76
+ @property({ type: String })
77
+ width: string = '100%';
78
+
79
+ /**
80
+ * The height of the component.
69
81
  *
70
- * The width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.
71
- * If the unit is %, the size will be relative to the container of the component.
82
+ * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
72
83
  */
73
- @property({ type: Object })
74
- size: { width?: string; height?: string } | undefined = undefined;
84
+ @property({ type: String })
85
+ height: string = '700px';
75
86
 
76
87
  override render() {
77
88
  return (
@@ -80,7 +91,8 @@ export class RelativeGrowthAdvantageComponent extends PreactLitAdapter {
80
91
  denominator={this.denominator}
81
92
  generationTime={this.generationTime}
82
93
  views={this.views}
83
- size={this.size}
94
+ width={this.width}
95
+ height={this.height}
84
96
  headline={this.headline}
85
97
  />
86
98
  );