@genspectrum/dashboard-components 0.6.15 → 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.
@@ -1022,17 +1022,17 @@ declare global {
1022
1022
 
1023
1023
  declare global {
1024
1024
  interface HTMLElementTagNameMap {
1025
- 'gs-mutations-over-time-component': MutationsOverTimeComponent;
1025
+ 'gs-date-range-selector': DateRangeSelectorComponent;
1026
+ }
1027
+ interface HTMLElementEventMap {
1028
+ 'gs-date-range-changed': CustomEvent<Record<string, string>>;
1026
1029
  }
1027
1030
  }
1028
1031
 
1029
1032
 
1030
1033
  declare global {
1031
1034
  interface HTMLElementTagNameMap {
1032
- 'gs-date-range-selector': DateRangeSelectorComponent;
1033
- }
1034
- interface HTMLElementEventMap {
1035
- 'gs-date-range-changed': CustomEvent<Record<string, string>>;
1035
+ 'gs-mutations-over-time-component': MutationsOverTimeComponent;
1036
1036
  }
1037
1037
  }
1038
1038
 
@@ -1059,21 +1059,21 @@ declare global {
1059
1059
 
1060
1060
  declare global {
1061
1061
  interface HTMLElementTagNameMap {
1062
- 'gs-lineage-filter': LineageFilterComponent;
1062
+ 'gs-mutation-filter': MutationFilterComponent;
1063
1063
  }
1064
1064
  interface HTMLElementEventMap {
1065
- 'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
1065
+ 'gs-mutation-filter-changed': CustomEvent<SelectedMutationFilterStrings>;
1066
+ 'gs-mutation-filter-on-blur': CustomEvent<SelectedMutationFilterStrings>;
1066
1067
  }
1067
1068
  }
1068
1069
 
1069
1070
 
1070
1071
  declare global {
1071
1072
  interface HTMLElementTagNameMap {
1072
- 'gs-mutation-filter': MutationFilterComponent;
1073
+ 'gs-lineage-filter': LineageFilterComponent;
1073
1074
  }
1074
1075
  interface HTMLElementEventMap {
1075
- 'gs-mutation-filter-changed': CustomEvent<SelectedMutationFilterStrings>;
1076
- 'gs-mutation-filter-on-blur': CustomEvent<SelectedMutationFilterStrings>;
1076
+ 'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
1077
1077
  }
1078
1078
  }
1079
1079
 
package/dist/style.css CHANGED
@@ -3036,9 +3036,6 @@ input.tab:checked + .tab-content,
3036
3036
  .w-32 {
3037
3037
  width: 8rem;
3038
3038
  }
3039
- .w-44 {
3040
- width: 11rem;
3041
- }
3042
3039
  .w-64 {
3043
3040
  width: 16rem;
3044
3041
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genspectrum/dashboard-components",
3
- "version": "0.6.15",
3
+ "version": "0.6.16",
4
4
  "description": "GenSpectrum web components for building dashboards",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
@@ -17,7 +17,8 @@ export default meta;
17
17
  const WrapperWithState: FunctionComponent<{
18
18
  setMinProportion: (value: number) => void;
19
19
  setMaxProportion: (value: number) => void;
20
- }> = ({ setMinProportion, setMaxProportion }) => {
20
+ labelPrefix?: string;
21
+ }> = ({ setMinProportion, setMaxProportion, labelPrefix }) => {
21
22
  const [proportionInterval, setProportionInterval] = useState({ min: 0.05, max: 1 });
22
23
 
23
24
  return (
@@ -31,24 +32,32 @@ const WrapperWithState: FunctionComponent<{
31
32
  setProportionInterval({ ...proportionInterval, max: value });
32
33
  setMaxProportion(value);
33
34
  }}
35
+ labelPrefix={labelPrefix}
34
36
  />
35
37
  );
36
38
  };
37
39
 
38
40
  export const ProportionSelectorStory: StoryObj<ProportionSelectorDropdownProps> = {
39
41
  render: (args) => {
40
- return <WrapperWithState setMinProportion={args.setMinProportion} setMaxProportion={args.setMaxProportion} />;
42
+ return (
43
+ <WrapperWithState
44
+ setMinProportion={args.setMinProportion}
45
+ setMaxProportion={args.setMaxProportion}
46
+ labelPrefix={args.labelPrefix}
47
+ />
48
+ );
41
49
  },
42
50
  args: {
43
51
  setMinProportion: fn(),
44
52
  setMaxProportion: fn(),
53
+ labelPrefix: 'TestPrefix',
45
54
  },
46
55
  play: async ({ canvasElement, step, args }) => {
47
56
  const canvas = within(canvasElement);
48
57
 
49
58
  await step('Expect initial proportion to show on the button', async () => {
50
59
  const button = canvas.getByRole('button');
51
- await expect(button).toHaveTextContent('Proportion 5.0% - 100.0%');
60
+ await expect(button).toHaveTextContent('TestPrefix 5.0% - 100.0%');
52
61
  });
53
62
 
54
63
  await step('Change min proportion and expect it to show on the button', async () => {
@@ -59,7 +68,7 @@ export const ProportionSelectorStory: StoryObj<ProportionSelectorDropdownProps>
59
68
  await userEvent.clear(minInput);
60
69
  await userEvent.type(minInput, '10');
61
70
 
62
- await waitFor(() => expect(button).toHaveTextContent('Proportion 10.0% - 100.0%'));
71
+ await waitFor(() => expect(button).toHaveTextContent('TestPrefix 10.0% - 100.0%'));
63
72
  await expect(args.setMinProportion).toHaveBeenCalledWith(0.1);
64
73
  });
65
74
  },
@@ -3,18 +3,21 @@ import { type FunctionComponent } from 'preact';
3
3
  import { Dropdown } from './dropdown';
4
4
  import { ProportionSelector, type ProportionSelectorProps } from './proportion-selector';
5
5
 
6
- export type ProportionSelectorDropdownProps = ProportionSelectorProps;
6
+ export type ProportionSelectorDropdownProps = ProportionSelectorProps & { labelPrefix?: string };
7
7
 
8
8
  export const ProportionSelectorDropdown: FunctionComponent<ProportionSelectorDropdownProps> = ({
9
9
  proportionInterval,
10
10
  setMinProportion,
11
11
  setMaxProportion,
12
+ labelPrefix = 'Proportion',
12
13
  }) => {
13
- const label = `${(proportionInterval.min * 100).toFixed(1)}% - ${(proportionInterval.max * 100).toFixed(1)}%`;
14
+ const percentLabel = `${(proportionInterval.min * 100).toFixed(1)}% - ${(proportionInterval.max * 100).toFixed(1)}%`;
15
+
16
+ const width = 'w-[calc(1.5 * var(--tw-space-x-reverse) + 1.5 * var(--tw-space-x))]';
14
17
 
15
18
  return (
16
- <div className='w-44'>
17
- <Dropdown buttonTitle={`Proportion ${label}`} placement={'bottom-start'}>
19
+ <div className={width}>
20
+ <Dropdown buttonTitle={`${labelPrefix} ${percentLabel}`} placement={'bottom-start'}>
18
21
  <ProportionSelector
19
22
  proportionInterval={proportionInterval}
20
23
  setMinProportion={setMinProportion}
@@ -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'
@@ -23184,10 +23184,11 @@ const NS = ({
23184
23184
  }, ed = ({
23185
23185
  proportionInterval: n,
23186
23186
  setMinProportion: t,
23187
- setMaxProportion: e
23187
+ setMaxProportion: e,
23188
+ labelPrefix: r = "Proportion"
23188
23189
  }) => {
23189
- const r = `${(n.min * 100).toFixed(1)}% - ${(n.max * 100).toFixed(1)}%`;
23190
- return /* @__PURE__ */ m("div", { className: "w-44", children: /* @__PURE__ */ m(Qu, { buttonTitle: `Proportion ${r}`, placement: "bottom-start", children: /* @__PURE__ */ m(
23190
+ const i = `${(n.min * 100).toFixed(1)}% - ${(n.max * 100).toFixed(1)}%`;
23191
+ return /* @__PURE__ */ m("div", { className: "w-[calc(1.5 * var(--tw-space-x-reverse) + 1.5 * var(--tw-space-x))]", children: /* @__PURE__ */ m(Qu, { buttonTitle: `${r} ${i}`, placement: "bottom-start", children: /* @__PURE__ */ m(
23191
23192
  NS,
23192
23193
  {
23193
23194
  proportionInterval: n,
@@ -26422,9 +26423,6 @@ input.tab:checked + .tab-content,
26422
26423
  .w-32 {
26423
26424
  width: 8rem;
26424
26425
  }
26425
- .w-44 {
26426
- width: 11rem;
26427
- }
26428
26426
  .w-64 {
26429
26427
  width: 16rem;
26430
26428
  }
@@ -29853,7 +29851,8 @@ const yA = ({
29853
29851
  {
29854
29852
  proportionInterval: o,
29855
29853
  setMinProportion: (u) => s((d) => ({ ...d, min: u })),
29856
- setMaxProportion: (u) => s((d) => ({ ...d, max: u }))
29854
+ setMaxProportion: (u) => s((d) => ({ ...d, max: u })),
29855
+ labelPrefix: "Mean proportion"
29857
29856
  }
29858
29857
  ),
29859
29858
  /* @__PURE__ */ m(