@genspectrum/dashboard-components 1.5.0 → 1.6.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.
@@ -1063,7 +1063,7 @@
1063
1063
  "type": {
1064
1064
  "text": "Meta<MutationFilterProps>"
1065
1065
  },
1066
- "default": "{ title: 'Input/Mutation filter', component: 'gs-mutation-filter', parameters: withComponentDocs({ actions: { handles: [gsEventNames.mutationFilterChanged, ...previewHandles], }, fetchMock: {}, componentDocs: { opensShadowDom: true, expectsChildren: false, codeExample, }, }), argTypes: { initialValue: { control: { type: 'object', }, }, width: { control: 'text' }, }, tags: ['autodocs'], }"
1066
+ "default": "{ title: 'Input/Mutation filter', component: 'gs-mutation-filter', parameters: withComponentDocs({ actions: { handles: [gsEventNames.mutationFilterChanged, ...previewHandles], }, fetchMock: {}, componentDocs: { opensShadowDom: true, expectsChildren: false, codeExample, }, }), argTypes: { initialValue: { control: { type: 'object', }, }, width: { control: 'text' }, enabledMutationTypes: { control: { type: 'object', }, }, }, tags: ['autodocs'], }"
1067
1067
  },
1068
1068
  {
1069
1069
  "kind": "variable",
@@ -1081,6 +1081,14 @@
1081
1081
  },
1082
1082
  "default": "{ ...Template, play: async ({ canvasElement, step }) => { const canvas = await withinShadowRoot(canvasElement, 'gs-mutation-filter'); const inputField = () => canvas.getByPlaceholderText('Enter a mutation', { exact: false }); const listenerMock = fn(); await step('Setup event listener mock', () => { canvasElement.addEventListener(gsEventNames.mutationFilterChanged, listenerMock); }); await step('wait until data is loaded', async () => { await waitFor(() => { return expect(inputField()).toBeEnabled(); }); }); await step('Enter a valid mutation', async () => { await userEvent.type(inputField(), 'A123T'); const option = await canvas.findByRole('option'); await userEvent.click(option); await waitFor(() => expect(listenerMock).toHaveBeenCalledWith( expect.objectContaining({ detail: { nucleotideMutations: ['A123T'], aminoAcidMutations: [], nucleotideInsertions: [], aminoAcidInsertions: [], }, }), ), ); }); }, }"
1083
1083
  },
1084
+ {
1085
+ "kind": "variable",
1086
+ "name": "RestrictEnabledMutationTypes",
1087
+ "type": {
1088
+ "text": "StoryObj<MutationFilterProps>"
1089
+ },
1090
+ "default": "{ ...Template, args: { ...Template.args, enabledMutationTypes: ['nucleotideMutations', 'aminoAcidMutations'], }, play: async ({ canvasElement }) => { const canvas = await withinShadowRoot(canvasElement, 'gs-mutation-filter'); const inputField = () => canvas.getByPlaceholderText('Enter a mutation', { exact: false }); await waitFor(async () => { const placeholderText = inputField().getAttribute('placeholder'); await expect(placeholderText).toEqual('Enter a mutation (e.g. 23T, E:57Q)'); }); }, }"
1091
+ },
1084
1092
  {
1085
1093
  "kind": "variable",
1086
1094
  "name": "MultiSegmentedReferenceGenomes",
@@ -1115,6 +1123,14 @@
1115
1123
  "module": "src/web-components/input/gs-mutation-filter.stories.ts"
1116
1124
  }
1117
1125
  },
1126
+ {
1127
+ "kind": "js",
1128
+ "name": "RestrictEnabledMutationTypes",
1129
+ "declaration": {
1130
+ "name": "RestrictEnabledMutationTypes",
1131
+ "module": "src/web-components/input/gs-mutation-filter.stories.ts"
1132
+ }
1133
+ },
1118
1134
  {
1119
1135
  "kind": "js",
1120
1136
  "name": "MultiSegmentedReferenceGenomes",
@@ -1131,7 +1147,7 @@
1131
1147
  "declarations": [
1132
1148
  {
1133
1149
  "kind": "class",
1134
- "description": "## Context\nThis component provides an input field to specify filters for nucleotide and amino acid mutations and insertions.\n\nInput values have to be provided one at a time and submitted by pressing the Enter key or by selecting an option from the dropdown.\nAlternatively, they can be provided as a string of comma-separated values, which will be directly parsed and validated.\nAfter submission (after pressing Enter or pasting a comma-separated string) an event is fired with the selected mutations.\nAll previously selected mutations are displayed at the input field and added to the event.\nUsers can remove a mutation by clicking the 'x' button next to the mutation.\n\n## Input Validation\n\nValidation of the input is performed according to the following rules:\n\n### Mutations\n\nMutations have to conform to the following format: `<gene/segment>:<symbol at reference><position><Substituted symbol/Deletion>`\n- Gene/segment: The gene or segment where the mutation occurs. Must be contained in the reference genome.\n (Optional for elements with only one gene/segment)\n- Symbol at reference: The symbol at the reference position. (Optional)\n- Position: The position of the mutation. (Required)\n- Substituted symbol/Deletion: The substituted symbol or '-' for a deletion. (Required)\n\nExamples: `S:614G`, `614G`, `614-`, `614G`\n\n### Insertions\n\nInsertions have to conform to the following format: `ins_<gene/segment>:<position>:<Inserted symbols>`\n- Gene/segment: The gene or segment where the insertion occurs. Must be contained in the reference genome.\n (Optional for elements with only one gene/segment)\n- Position: The position of the insertion. (Required)\n- Inserted symbols: The symbols that are inserted. (Required)\n\nExamples: `ins_S:614:G`, `ins_614:G`",
1150
+ "description": "## Context\nThis component provides an input field to specify filters for nucleotide and amino acid mutations and insertions.\n\nInput values have to be provided one at a time and submitted by pressing the Enter key or by selecting an option from the dropdown.\nAlternatively, they can be provided as a string of comma-separated values, which will be directly parsed and validated.\nAfter submission (after pressing Enter or pasting a comma-separated string) an event is fired with the selected mutations.\nAll previously selected mutations are displayed at the input field and added to the event.\nUsers can remove a mutation by clicking the 'x' button next to the mutation.\n\n## Input Validation\n\nValidation of the input is performed according to the following rules:\n\n### Mutations\n\nMutations have to conform to the following format: `<gene/segment>:<symbol at reference><position><Substituted symbol/Deletion>`\n- Gene/segment: The gene or segment where the mutation occurs. Must be contained in the reference genome.\n (Optional for elements with only one gene/segment)\n- Symbol at reference: The symbol at the reference position. (Optional)\n- Position: The position of the mutation. (Required)\n- Substituted symbol/Deletion: The substituted symbol or '-' for a deletion. (Required)\n\nExamples: `S:614G`, `614G`, `614-`, `614G`\n\n### Insertions\n\nInsertions have to conform to the following format: `ins_<gene/segment>:<position>:<Inserted symbols>`\n- Gene/segment: The gene or segment where the insertion occurs. Must be contained in the reference genome.\n (Optional for elements with only one gene/segment)\n- Position: The position of the insertion. (Required)\n- Inserted symbols: The symbols that are inserted. (Required)\n\nExamples: `ins_S:614:G`, `ins_614:G`\n\n### Enabled mutation types\n\nAfter parsing, the entered mutation/insertion also has to match the enabled mutation types,\nwhich are configured with the `enabledMutationTypes` attribute.",
1135
1151
  "name": "MutationFilterComponent",
1136
1152
  "members": [
1137
1153
  {
@@ -1153,6 +1169,16 @@
1153
1169
  "default": "'100%'",
1154
1170
  "description": "The width of the component.\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/concepts-size-of-components--docs for more information.",
1155
1171
  "attribute": "width"
1172
+ },
1173
+ {
1174
+ "kind": "field",
1175
+ "name": "enabledMutationTypes",
1176
+ "type": {
1177
+ "text": "MutationType[] | undefined"
1178
+ },
1179
+ "default": "undefined",
1180
+ "description": "Which mutation types this input will accept.\nAny (or all) of the following can be given in a list:\n\n- `nucleotideMutations`\n- `nucleotideInsertions`\n- `aminoAcidMutations`\n- `aminoAcidInsertions`\n\nBy default or if none are given, all types are accepted.",
1181
+ "attribute": "enabledMutationTypes"
1156
1182
  }
1157
1183
  ],
1158
1184
  "events": [
@@ -1182,6 +1208,15 @@
1182
1208
  "default": "'100%'",
1183
1209
  "description": "The width of the component.\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/concepts-size-of-components--docs for more information.",
1184
1210
  "fieldName": "width"
1211
+ },
1212
+ {
1213
+ "name": "enabledMutationTypes",
1214
+ "type": {
1215
+ "text": "MutationType[] | undefined"
1216
+ },
1217
+ "default": "undefined",
1218
+ "description": "Which mutation types this input will accept.\nAny (or all) of the following can be given in a list:\n\n- `nucleotideMutations`\n- `nucleotideInsertions`\n- `aminoAcidMutations`\n- `aminoAcidInsertions`\n\nBy default or if none are given, all types are accepted.",
1219
+ "fieldName": "enabledMutationTypes"
1185
1220
  }
1186
1221
  ],
1187
1222
  "superclass": {