@genspectrum/dashboard-components 0.6.14 → 0.6.16

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 (35) hide show
  1. package/custom-elements.json +12 -6
  2. package/dist/dashboard-components.js +104 -60
  3. package/dist/dashboard-components.js.map +1 -1
  4. package/dist/genspectrum-components.d.ts +27 -9
  5. package/dist/style.css +2 -5
  6. package/package.json +3 -3
  7. package/src/index.ts +8 -0
  8. package/src/lapisApi/lapisApi.ts +15 -7
  9. package/src/preact/components/color-scale-selector-dropdown.stories.tsx +1 -1
  10. package/src/preact/components/error-boundary.stories.tsx +21 -4
  11. package/src/preact/components/error-display.stories.tsx +20 -2
  12. package/src/preact/components/error-display.tsx +64 -10
  13. package/src/preact/components/info.stories.tsx +5 -5
  14. package/src/preact/components/info.tsx +1 -3
  15. package/src/preact/components/proportion-selector-dropdown.stories.tsx +13 -4
  16. package/src/preact/components/proportion-selector-dropdown.tsx +7 -4
  17. package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +2 -3
  18. package/src/preact/lineageFilter/lineage-filter.stories.tsx +2 -3
  19. package/src/preact/locationFilter/fetchAutocompletionList.ts +1 -14
  20. package/src/preact/locationFilter/location-filter.stories.tsx +2 -3
  21. package/src/preact/mutationFilter/mutation-filter.stories.tsx +2 -3
  22. package/src/preact/mutationsOverTime/mutations-over-time.tsx +1 -0
  23. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +1 -1
  24. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +1 -1
  25. package/src/preact/shared/floating-ui/hooks.ts +1 -1
  26. package/src/preact/textInput/text-input.stories.tsx +2 -3
  27. package/src/web-components/app.stories.ts +0 -2
  28. package/src/web-components/errorHandling.mdx +8 -0
  29. package/src/web-components/input/gs-date-range-selector.stories.ts +2 -3
  30. package/src/web-components/input/gs-lineage-filter.stories.ts +2 -3
  31. package/src/web-components/input/gs-location-filter.stories.ts +2 -3
  32. package/src/web-components/input/gs-mutation-filter.stories.ts +2 -3
  33. package/src/web-components/input/gs-text-input.stories.ts +2 -3
  34. package/standalone-bundle/dashboard-components.js +1724 -1692
  35. package/standalone-bundle/dashboard-components.js.map +1 -1
@@ -1,9 +1,9 @@
1
- import { withActions } from '@storybook/addon-actions/decorator';
2
1
  import { type Meta, type PreactRenderer, type StoryObj } from '@storybook/preact';
3
2
  import { expect, fireEvent, fn, userEvent, waitFor, within } from '@storybook/test';
4
3
  import { type StepFunction } from '@storybook/types';
5
4
 
6
5
  import { MutationFilter, type MutationFilterProps } from './mutation-filter';
6
+ import { previewHandles } from '../../../.storybook/preview';
7
7
  import { LAPIS_URL } from '../../constants';
8
8
  import referenceGenome from '../../lapisApi/__mockData__/referenceGenome.json';
9
9
  import { LapisUrlContext } from '../LapisUrlContext';
@@ -14,7 +14,7 @@ const meta: Meta<MutationFilterProps> = {
14
14
  component: MutationFilter,
15
15
  parameters: {
16
16
  actions: {
17
- handles: ['gs-mutation-filter-changed', 'gs-mutation-filter-on-blur'],
17
+ handles: ['gs-mutation-filter-changed', 'gs-mutation-filter-on-blur', ...previewHandles],
18
18
  },
19
19
  fetchMock: {},
20
20
  },
@@ -26,7 +26,6 @@ const meta: Meta<MutationFilterProps> = {
26
26
  },
27
27
  },
28
28
  },
29
- decorators: [withActions],
30
29
  };
31
30
 
32
31
  export default meta;
@@ -204,6 +204,7 @@ const Toolbar: FunctionComponent<ToolbarProps> = ({
204
204
  proportionInterval={proportionInterval}
205
205
  setMinProportion={(min) => setProportionInterval((prev) => ({ ...prev, min }))}
206
206
  setMaxProportion={(max) => setProportionInterval((prev) => ({ ...prev, max }))}
207
+ labelPrefix='Mean proportion'
207
208
  />
208
209
  <CsvDownloadButton
209
210
  className='mx-1 btn btn-xs'
@@ -69,7 +69,7 @@ export const PrevalenceOverTimeInner: FunctionComponent<PrevalenceOverTimeProps>
69
69
  lapis,
70
70
  lapisDateField,
71
71
  ),
72
- [lapis, numeratorFilter, denominatorFilter, granularity, smoothingWindow],
72
+ [lapis, numeratorFilter, denominatorFilter, granularity, smoothingWindow, lapisDateField],
73
73
  );
74
74
 
75
75
  if (isLoading) {
@@ -66,7 +66,7 @@ export const RelativeGrowthAdvantageInner: FunctionComponent<RelativeGrowthAdvan
66
66
 
67
67
  const { data, error, isLoading } = useQuery(
68
68
  () => queryRelativeGrowthAdvantage(numeratorFilter, denominatorFilter, generationTime, lapis, lapisDateField),
69
- [lapis, numeratorFilter, denominatorFilter, generationTime, views],
69
+ [lapis, numeratorFilter, denominatorFilter, generationTime, views, lapisDateField],
70
70
  );
71
71
 
72
72
  if (isLoading) {
@@ -9,7 +9,7 @@ export function useFloatingUi(
9
9
  middleware?: Array<Middleware | null | undefined | false>,
10
10
  placement?: Placement,
11
11
  ) {
12
- const cleanupRef = useRef<Function | null>(null);
12
+ const cleanupRef = useRef<() => void | null>(null);
13
13
 
14
14
  useEffect(() => {
15
15
  if (!referenceRef.current || !floatingRef.current) {
@@ -1,9 +1,9 @@
1
- import { withActions } from '@storybook/addon-actions/decorator';
2
1
  import { type Meta, type StoryObj } from '@storybook/preact';
3
2
  import { expect, waitFor, within } from '@storybook/test';
4
3
 
5
4
  import data from './__mockData__/aggregated_hosts.json';
6
5
  import { TextInput, type TextInputProps } from './text-input';
6
+ import { previewHandles } from '../../../.storybook/preview';
7
7
  import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
8
8
  import { LapisUrlContext } from '../LapisUrlContext';
9
9
 
@@ -12,7 +12,7 @@ const meta: Meta<TextInputProps> = {
12
12
  component: TextInput,
13
13
  parameters: {
14
14
  actions: {
15
- handles: ['gs-text-input-changed'],
15
+ handles: ['gs-text-input-changed', ...previewHandles],
16
16
  },
17
17
  fetchMock: {
18
18
  mocks: [
@@ -32,7 +32,6 @@ const meta: Meta<TextInputProps> = {
32
32
  ],
33
33
  },
34
34
  },
35
- decorators: [withActions],
36
35
  argTypes: {
37
36
  lapisField: {
38
37
  control: {
@@ -1,5 +1,4 @@
1
1
  import { consume } from '@lit/context';
2
- import { withActions } from '@storybook/addon-actions/decorator';
3
2
  import { expect, waitFor, within } from '@storybook/test';
4
3
  import type { Meta, StoryObj } from '@storybook/web-components';
5
4
  import { html, LitElement } from 'lit';
@@ -30,7 +29,6 @@ const meta: Meta = {
30
29
  codeExample,
31
30
  },
32
31
  }),
33
- decorators: [withActions],
34
32
  tags: ['autodocs'],
35
33
  };
36
34
 
@@ -0,0 +1,8 @@
1
+ import { Meta } from '@storybook/blocks';
2
+
3
+ <Meta title='Components/Error Handling' />
4
+
5
+ # Error Handling
6
+
7
+ All components dispatch a `gs-error` event of type `ErrorEvent` when an error occurs.
8
+ The event contains an `error` property that holds the `Error` object.
@@ -1,9 +1,9 @@
1
- import { withActions } from '@storybook/addon-actions/decorator';
2
1
  import { expect, waitFor } from '@storybook/test';
3
2
  import type { Meta, StoryObj } from '@storybook/web-components';
4
3
  import { html } from 'lit';
5
4
 
6
5
  import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
6
+ import { previewHandles } from '../../../.storybook/preview';
7
7
  import { LAPIS_URL } from '../../constants';
8
8
  import { type DateRangeSelectorProps } from '../../preact/dateRangeSelector/date-range-selector';
9
9
  import './gs-date-range-selector';
@@ -36,7 +36,7 @@ const meta: Meta<Required<DateRangeSelectorProps<'CustomDateRange'>>> = {
36
36
  component: 'gs-date-range-selector',
37
37
  parameters: withComponentDocs({
38
38
  actions: {
39
- handles: ['gs-date-range-changed'],
39
+ handles: ['gs-date-range-changed', ...previewHandles],
40
40
  },
41
41
  fetchMock: {},
42
42
  componentDocs: {
@@ -87,7 +87,6 @@ const meta: Meta<Required<DateRangeSelectorProps<'CustomDateRange'>>> = {
87
87
  initialDateFrom: '',
88
88
  initialDateTo: '',
89
89
  },
90
- decorators: [withActions],
91
90
  tags: ['autodocs'],
92
91
  };
93
92
 
@@ -1,9 +1,9 @@
1
- import { withActions } from '@storybook/addon-actions/decorator';
2
1
  import { expect, fn, userEvent, waitFor } from '@storybook/test';
3
2
  import type { Meta, StoryObj } from '@storybook/web-components';
4
3
  import { html } from 'lit';
5
4
 
6
5
  import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
6
+ import { previewHandles } from '../../../.storybook/preview';
7
7
  import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
8
8
  import '../app';
9
9
  import './gs-lineage-filter';
@@ -24,7 +24,7 @@ const meta: Meta<Required<LineageFilterProps>> = {
24
24
  component: 'gs-lineage-filter',
25
25
  parameters: withComponentDocs({
26
26
  actions: {
27
- handles: ['gs-lineage-filter-changed'],
27
+ handles: ['gs-lineage-filter-changed', ...previewHandles],
28
28
  },
29
29
  fetchMock: {
30
30
  mocks: [
@@ -49,7 +49,6 @@ const meta: Meta<Required<LineageFilterProps>> = {
49
49
  codeExample,
50
50
  },
51
51
  }),
52
- decorators: [withActions],
53
52
  tags: ['autodocs'],
54
53
  };
55
54
 
@@ -1,10 +1,10 @@
1
- import { withActions } from '@storybook/addon-actions/decorator';
2
1
  import { expect, fn, userEvent, waitFor } from '@storybook/test';
3
2
  import type { Meta, StoryObj } from '@storybook/web-components';
4
3
  import { html } from 'lit';
5
4
  import { ifDefined } from 'lit/directives/if-defined.js';
6
5
 
7
6
  import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
7
+ import { previewHandles } from '../../../.storybook/preview';
8
8
  import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
9
9
  import '../app';
10
10
  import './gs-location-filter';
@@ -25,7 +25,7 @@ const meta: Meta = {
25
25
  component: 'gs-location-filter',
26
26
  parameters: withComponentDocs({
27
27
  actions: {
28
- handles: ['gs-location-changed'],
28
+ handles: ['gs-location-changed', ...previewHandles],
29
29
  },
30
30
  componentDocs: {
31
31
  opensShadowDom: true,
@@ -55,7 +55,6 @@ const meta: Meta = {
55
55
  },
56
56
  },
57
57
  },
58
- decorators: [withActions],
59
58
  tags: ['autodocs'],
60
59
  };
61
60
 
@@ -1,9 +1,9 @@
1
- import { withActions } from '@storybook/addon-actions/decorator';
2
1
  import { expect, fn, userEvent, waitFor } from '@storybook/test';
3
2
  import type { Meta, StoryObj } from '@storybook/web-components';
4
3
  import { html } from 'lit';
5
4
 
6
5
  import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
6
+ import { previewHandles } from '../../../.storybook/preview';
7
7
  import { LAPIS_URL, REFERENCE_GENOME_ENDPOINT } from '../../constants';
8
8
  import '../app';
9
9
  import { type MutationFilterProps } from '../../preact/mutationFilter/mutation-filter';
@@ -21,7 +21,7 @@ const meta: Meta<MutationFilterProps> = {
21
21
  component: 'gs-mutation-filter',
22
22
  parameters: withComponentDocs({
23
23
  actions: {
24
- handles: ['gs-mutation-filter-changed', 'gs-mutation-filter-on-blur'],
24
+ handles: ['gs-mutation-filter-changed', 'gs-mutation-filter-on-blur', ...previewHandles],
25
25
  },
26
26
  fetchMock: {},
27
27
  componentDocs: {
@@ -38,7 +38,6 @@ const meta: Meta<MutationFilterProps> = {
38
38
  },
39
39
  width: { control: 'text' },
40
40
  },
41
- decorators: [withActions],
42
41
  tags: ['autodocs'],
43
42
  };
44
43
 
@@ -1,9 +1,9 @@
1
- import { withActions } from '@storybook/addon-actions/decorator';
2
1
  import { expect, fn, userEvent, waitFor } from '@storybook/test';
3
2
  import type { Meta, StoryObj } from '@storybook/web-components';
4
3
  import { html } from 'lit';
5
4
 
6
5
  import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
6
+ import { previewHandles } from '../../../.storybook/preview';
7
7
  import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
8
8
  import '../app';
9
9
  import './gs-text-input';
@@ -24,7 +24,7 @@ const meta: Meta<Required<TextInputProps>> = {
24
24
  component: 'gs-text-input',
25
25
  parameters: withComponentDocs({
26
26
  actions: {
27
- handles: ['gs-text-input-changed'],
27
+ handles: ['gs-text-input-changed', ...previewHandles],
28
28
  },
29
29
  fetchMock: {
30
30
  mocks: [
@@ -71,7 +71,6 @@ const meta: Meta<Required<TextInputProps>> = {
71
71
  },
72
72
  },
73
73
  },
74
- decorators: [withActions],
75
74
  tags: ['autodocs'],
76
75
  };
77
76