@genspectrum/dashboard-components 0.13.7 → 0.14.1

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 +13 -51
  2. package/dist/{LineageFilterChangedEvent-GedKNGFI.js → LineageFilterChangedEvent-C9dXOxt6.js} +11 -3
  3. package/dist/LineageFilterChangedEvent-C9dXOxt6.js.map +1 -0
  4. package/dist/components.d.ts +61 -67
  5. package/dist/components.js +95 -84
  6. package/dist/components.js.map +1 -1
  7. package/dist/util.d.ts +60 -50
  8. package/dist/util.js +1 -1
  9. package/package.json +1 -1
  10. package/src/preact/LapisUrlContext.ts +14 -1
  11. package/src/preact/aggregatedData/aggregate.stories.tsx +3 -3
  12. package/src/preact/aggregatedData/aggregate.tsx +3 -4
  13. package/src/preact/dateRangeSelector/computeInitialValues.spec.ts +34 -20
  14. package/src/preact/dateRangeSelector/computeInitialValues.ts +25 -21
  15. package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +104 -40
  16. package/src/preact/dateRangeSelector/date-range-selector.tsx +29 -20
  17. package/src/preact/dateRangeSelector/dateRangeOption.ts +11 -1
  18. package/src/preact/lineageFilter/lineage-filter.stories.tsx +3 -3
  19. package/src/preact/lineageFilter/lineage-filter.tsx +3 -4
  20. package/src/preact/locationFilter/location-filter.stories.tsx +3 -3
  21. package/src/preact/locationFilter/location-filter.tsx +4 -4
  22. package/src/preact/map/sequences-by-location.stories.tsx +3 -3
  23. package/src/preact/map/sequences-by-location.tsx +3 -4
  24. package/src/preact/mutationComparison/mutation-comparison.stories.tsx +3 -3
  25. package/src/preact/mutationComparison/mutation-comparison.tsx +4 -4
  26. package/src/preact/mutationFilter/mutation-filter-info.tsx +3 -3
  27. package/src/preact/mutationFilter/mutation-filter.stories.tsx +5 -5
  28. package/src/preact/mutations/mutations.stories.tsx +3 -3
  29. package/src/preact/mutations/mutations.tsx +4 -4
  30. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +3 -3
  31. package/src/preact/mutationsOverTime/mutations-over-time.tsx +4 -4
  32. package/src/preact/numberSequencesOverTime/number-sequences-over-time.stories.tsx +3 -3
  33. package/src/preact/numberSequencesOverTime/number-sequences-over-time.tsx +4 -4
  34. package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +3 -3
  35. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +4 -4
  36. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +3 -3
  37. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +4 -4
  38. package/src/preact/statistic/statistics.stories.tsx +3 -3
  39. package/src/preact/statistic/statistics.tsx +2 -3
  40. package/src/preact/textInput/text-input.stories.tsx +3 -3
  41. package/src/preact/textInput/text-input.tsx +3 -4
  42. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.stories.tsx +3 -3
  43. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +4 -4
  44. package/src/web-components/PreactLitAdapter.tsx +3 -3
  45. package/src/web-components/gs-app.ts +3 -1
  46. package/src/web-components/input/gs-date-range-selector.stories.ts +5 -12
  47. package/src/web-components/input/gs-date-range-selector.tsx +15 -38
  48. package/standalone-bundle/dashboard-components.js +6078 -6072
  49. package/standalone-bundle/dashboard-components.js.map +1 -1
  50. package/dist/LineageFilterChangedEvent-GedKNGFI.js.map +0 -1
@@ -6,7 +6,7 @@ import { options, createContext as createContext$1, Fragment, render, Component,
6
6
  import { Grid } from "gridjs";
7
7
  import { Chart, registerables, Scale, BarController } from "chart.js";
8
8
  import { VennDiagramController, ArcSlice, extractSets } from "chartjs-chart-venn";
9
- import { v as views, n as namedLapisFilterSchema, s as sequenceTypeSchema, l as lapisFilterSchema, t as temporalGranularitySchema, b as dateRangeOptionSchema, c as toYYYYMMDD, D as DateRangeOptionChangedEvent, e as lapisLocationFilterSchema, L as LocationChangedEvent, T as TextInputChangedEvent, m as mutationsFilterSchema, a as LineageFilterChangedEvent } from "./LineageFilterChangedEvent-GedKNGFI.js";
9
+ import { v as views, n as namedLapisFilterSchema, s as sequenceTypeSchema, l as lapisFilterSchema, t as temporalGranularitySchema, b as dateRangeOptionSchema, c as dateRangeValueSchema, e as toYYYYMMDD, D as DateRangeOptionChangedEvent, f as lapisLocationFilterSchema, L as LocationChangedEvent, T as TextInputChangedEvent, m as mutationsFilterSchema, a as LineageFilterChangedEvent } from "./LineageFilterChangedEvent-C9dXOxt6.js";
10
10
  import { autoUpdate, computePosition, offset, shift, flip } from "@floating-ui/dom";
11
11
  import { ReactiveElement } from "@lit/reactive-element";
12
12
  import { BarWithErrorBarsController, BarWithErrorBar } from "chartjs-chart-error-bars";
@@ -561,7 +561,9 @@ let AppComponent = class extends LitElement {
561
561
  this.updateReferenceGenome = new Task(this, {
562
562
  task: async () => {
563
563
  const lapisUrl = lapisUrlSchema.parse(this.lapis);
564
- this.referenceGenome = await fetchReferenceGenome(lapisUrl);
564
+ this.referenceGenome = await fetchReferenceGenome(
565
+ lapisUrl.endsWith("/") ? lapisUrl.slice(0, -1) : lapisUrl
566
+ );
565
567
  },
566
568
  args: () => [this.lapis]
567
569
  });
@@ -1255,6 +1257,14 @@ function filterBySegmentAndMutationType(data, displayedSegments, displayedMutati
1255
1257
  return data.filter(byDisplayedSegments).filter(byDisplayedMutationTypes);
1256
1258
  }
1257
1259
  const LapisUrlContext = createContext$1("");
1260
+ const LapisUrlContextProvider = LapisUrlContext.Provider;
1261
+ const useLapisUrl = () => {
1262
+ const lapisUrl = x$1(LapisUrlContext);
1263
+ if (lapisUrl.endsWith("/")) {
1264
+ return lapisUrl.slice(0, -1);
1265
+ }
1266
+ return lapisUrl;
1267
+ };
1258
1268
  const CsvDownloadButton = ({
1259
1269
  label = "Download",
1260
1270
  filename = "data.csv",
@@ -2108,7 +2118,7 @@ const MutationComparison = (componentProps) => {
2108
2118
  };
2109
2119
  const MutationComparisonInner = (componentProps) => {
2110
2120
  const { lapisFilters, sequenceType } = componentProps;
2111
- const lapis = x$1(LapisUrlContext);
2121
+ const lapis = useLapisUrl();
2112
2122
  const { data, error, isLoading } = useQuery(async () => {
2113
2123
  return queryMutationData(lapisFilters, sequenceType, lapis);
2114
2124
  }, [lapisFilters, sequenceType, lapis]);
@@ -2222,7 +2232,7 @@ const Toolbar$7 = ({
2222
2232
  ] });
2223
2233
  };
2224
2234
  const MutationComparisonInfo = ({ originalComponentProps }) => {
2225
- const lapis = x$1(LapisUrlContext);
2235
+ const lapis = useLapisUrl();
2226
2236
  return /* @__PURE__ */ u$1(Info, { children: [
2227
2237
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Info for mutation comparison" }),
2228
2238
  /* @__PURE__ */ u$1(InfoParagraph, { children: [
@@ -5546,7 +5556,7 @@ const _PreactLitAdapter = class _PreactLitAdapter extends ReactiveElement {
5546
5556
  };
5547
5557
  }
5548
5558
  update(changedProperties) {
5549
- const vdom = /* @__PURE__ */ u$1(LapisUrlContext.Provider, { value: this.lapis, children: /* @__PURE__ */ u$1(ReferenceGenomeContext.Provider, { value: this.referenceGenome, children: this.render() }) });
5559
+ const vdom = /* @__PURE__ */ u$1(LapisUrlContextProvider, { value: this.lapis, children: /* @__PURE__ */ u$1(ReferenceGenomeContext.Provider, { value: this.referenceGenome, children: this.render() }) });
5550
5560
  super.update(changedProperties);
5551
5561
  render(vdom, this.renderRoot);
5552
5562
  }
@@ -5972,7 +5982,7 @@ const Mutations = (componentProps) => {
5972
5982
  return /* @__PURE__ */ u$1(ErrorBoundary, { size, componentProps, schema: mutationsPropsSchema, children: /* @__PURE__ */ u$1(ResizeContainer, { size, children: /* @__PURE__ */ u$1(MutationsInner, { ...componentProps }) }) });
5973
5983
  };
5974
5984
  const MutationsInner = (componentProps) => {
5975
- const lapis = x$1(LapisUrlContext);
5985
+ const lapis = useLapisUrl();
5976
5986
  const { lapisFilter, baselineLapisFilter, sequenceType } = componentProps;
5977
5987
  const { data, error, isLoading } = useQuery(async () => {
5978
5988
  return queryMutationsData(lapisFilter, baselineLapisFilter, sequenceType, lapis);
@@ -6114,7 +6124,7 @@ const Toolbar$6 = ({
6114
6124
  ] });
6115
6125
  };
6116
6126
  const MutationsInfo = ({ originalComponentProps }) => {
6117
- const lapis = x$1(LapisUrlContext);
6127
+ const lapis = useLapisUrl();
6118
6128
  return /* @__PURE__ */ u$1(Info, { children: [
6119
6129
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Mutations" }),
6120
6130
  /* @__PURE__ */ u$1(InfoParagraph, { children: [
@@ -7855,7 +7865,7 @@ const PrevalenceOverTime = (componentProps) => {
7855
7865
  };
7856
7866
  const PrevalenceOverTimeInner = (componentProps) => {
7857
7867
  const { numeratorFilters, denominatorFilter, granularity, smoothingWindow, lapisDateField } = componentProps;
7858
- const lapis = x$1(LapisUrlContext);
7868
+ const lapis = useLapisUrl();
7859
7869
  const { data, error, isLoading } = useQuery(
7860
7870
  () => queryPrevalenceOverTime(
7861
7871
  numeratorFilters,
@@ -7989,7 +7999,7 @@ const Toolbar$5 = ({
7989
7999
  };
7990
8000
  const PrevalenceOverTimeInfo = (componentProps) => {
7991
8001
  const { granularity, smoothingWindow, views: views2 } = componentProps;
7992
- const lapis = x$1(LapisUrlContext);
8002
+ const lapis = useLapisUrl();
7993
8003
  return /* @__PURE__ */ u$1(Info, { children: [
7994
8004
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Prevalence over time" }),
7995
8005
  /* @__PURE__ */ u$1(InfoParagraph, { children: [
@@ -8344,7 +8354,7 @@ const RelativeGrowthAdvantage = (componentProps) => {
8344
8354
  return /* @__PURE__ */ u$1(ErrorBoundary, { size, schema: relativeGrowthAdvantagePropsSchema, componentProps, children: /* @__PURE__ */ u$1(ResizeContainer, { size, children: /* @__PURE__ */ u$1(RelativeGrowthAdvantageInner, { ...componentProps }) }) });
8345
8355
  };
8346
8356
  const RelativeGrowthAdvantageInner = (componentProps) => {
8347
- const lapis = x$1(LapisUrlContext);
8357
+ const lapis = useLapisUrl();
8348
8358
  const { numeratorFilter, denominatorFilter, generationTime, lapisDateField } = componentProps;
8349
8359
  const [yAxisScaleType, setYAxisScaleType] = h("linear");
8350
8360
  const { data, error, isLoading } = useQuery(
@@ -8427,7 +8437,7 @@ const RelativeGrowthAdvantageToolbar = ({
8427
8437
  const RelativeGrowthAdvantageInfo = ({
8428
8438
  originalComponentProps
8429
8439
  }) => {
8430
- const lapis = x$1(LapisUrlContext);
8440
+ const lapis = useLapisUrl();
8431
8441
  const generationTime = originalComponentProps.generationTime;
8432
8442
  return /* @__PURE__ */ u$1(Info, { children: [
8433
8443
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Relative growth advantage" }),
@@ -8722,7 +8732,7 @@ const Aggregate = (componentProps) => {
8722
8732
  };
8723
8733
  const AggregateInner = (componentProps) => {
8724
8734
  const { fields, lapisFilter, initialSortField, initialSortDirection } = componentProps;
8725
- const lapis = x$1(LapisUrlContext);
8735
+ const lapis = useLapisUrl();
8726
8736
  const { data, error, isLoading } = useQuery(async () => {
8727
8737
  return queryAggregateData(lapisFilter, fields, lapis);
8728
8738
  }, [lapisFilter, fields, lapis, initialSortField, initialSortDirection]);
@@ -8779,7 +8789,7 @@ const Toolbar$4 = ({ data, originalComponentProps }) => {
8779
8789
  ] });
8780
8790
  };
8781
8791
  const AggregateInfo = ({ originalComponentProps }) => {
8782
- const lapis = x$1(LapisUrlContext);
8792
+ const lapis = useLapisUrl();
8783
8793
  return /* @__PURE__ */ u$1(Info, { children: [
8784
8794
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Aggregated data" }),
8785
8795
  /* @__PURE__ */ u$1(InfoParagraph, { children: [
@@ -9038,7 +9048,7 @@ const NumberSequencesOverTime = (componentProps) => {
9038
9048
  };
9039
9049
  const NumberSequencesOverTimeInner = (componentProps) => {
9040
9050
  const { lapisFilters, lapisDateField, granularity, smoothingWindow } = componentProps;
9041
- const lapis = x$1(LapisUrlContext);
9051
+ const lapis = useLapisUrl();
9042
9052
  const { data, error, isLoading } = useQuery(
9043
9053
  () => queryNumberOfSequencesOverTime(lapis, lapisFilters, lapisDateField, granularity, smoothingWindow),
9044
9054
  [lapis, lapisFilters, lapisDateField, granularity, smoothingWindow]
@@ -9126,7 +9136,7 @@ const Toolbar$3 = ({ activeTab, data, yAxisScaleType, setYAxisScaleType, origina
9126
9136
  const NumberSequencesOverTimeInfo = ({
9127
9137
  originalComponentProps
9128
9138
  }) => {
9129
- const lapis = x$1(LapisUrlContext);
9139
+ const lapis = useLapisUrl();
9130
9140
  return /* @__PURE__ */ u$1(Info, { children: [
9131
9141
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Number of sequences over time" }),
9132
9142
  /* @__PURE__ */ u$1(InfoParagraph, { children: [
@@ -9702,7 +9712,7 @@ const MutationsOverTime = (componentProps) => {
9702
9712
  return /* @__PURE__ */ u$1(ErrorBoundary, { size, schema: mutationOverTimeSchema, componentProps, children: /* @__PURE__ */ u$1(ResizeContainer, { size, children: /* @__PURE__ */ u$1(MutationsOverTimeInner, { ...componentProps }) }) });
9703
9713
  };
9704
9714
  const MutationsOverTimeInner = (componentProps) => {
9705
- const lapis = x$1(LapisUrlContext);
9715
+ const lapis = useLapisUrl();
9706
9716
  const { lapisFilter, sequenceType, granularity, lapisDateField } = componentProps;
9707
9717
  const messageToWorker = T$1(() => {
9708
9718
  return {
@@ -9837,7 +9847,7 @@ const Toolbar$2 = ({
9837
9847
  ] });
9838
9848
  };
9839
9849
  const MutationsOverTimeInfo = ({ originalComponentProps }) => {
9840
- const lapis = x$1(LapisUrlContext);
9850
+ const lapis = useLapisUrl();
9841
9851
  return /* @__PURE__ */ u$1(Info, { children: [
9842
9852
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Mutations over time" }),
9843
9853
  /* @__PURE__ */ u$1(InfoParagraph, { children: [
@@ -10896,7 +10906,7 @@ const SequencesByLocation = (componentProps) => {
10896
10906
  };
10897
10907
  const SequencesByLocationMapInner = (props) => {
10898
10908
  const { lapisFilter, lapisLocationField, mapSource } = props;
10899
- const lapis = x$1(LapisUrlContext);
10909
+ const lapis = useLapisUrl();
10900
10910
  const {
10901
10911
  data,
10902
10912
  error,
@@ -10978,7 +10988,7 @@ const Toolbar$1 = ({ originalComponentProps, tableData }) => {
10978
10988
  ] });
10979
10989
  };
10980
10990
  const SequencesByLocationMapInfo = ({ originalComponentProps }) => {
10981
- const lapis = x$1(LapisUrlContext);
10991
+ const lapis = useLapisUrl();
10982
10992
  return /* @__PURE__ */ u$1(Info, { children: [
10983
10993
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Prevalence by location" }),
10984
10994
  /* @__PURE__ */ u$1(InfoParagraph, { children: "TODO: Add description https://github.com/GenSpectrum/dashboard-components/issues/598" }),
@@ -11089,7 +11099,7 @@ const Statistics = (componentProps) => {
11089
11099
  };
11090
11100
  const StatisticsInner = (componentProps) => {
11091
11101
  const { numeratorFilter, denominatorFilter } = componentProps;
11092
- const lapis = x$1(LapisUrlContext);
11102
+ const lapis = useLapisUrl();
11093
11103
  const { data, error, isLoading } = useQuery(async () => {
11094
11104
  return queryGeneralStatistics(numeratorFilter, denominatorFilter, lapis);
11095
11105
  }, [numeratorFilter, denominatorFilter, lapis]);
@@ -11263,7 +11273,7 @@ const WastewaterMutationsOverTime = (componentProps) => {
11263
11273
  return /* @__PURE__ */ u$1(ErrorBoundary, { size, schema: wastewaterMutationOverTimeSchema, componentProps, children: /* @__PURE__ */ u$1(ResizeContainer, { size, children: /* @__PURE__ */ u$1(WastewaterMutationsOverTimeInner, { ...componentProps }) }) });
11264
11274
  };
11265
11275
  const WastewaterMutationsOverTimeInner = (componentProps) => {
11266
- const lapis = x$1(LapisUrlContext);
11276
+ const lapis = useLapisUrl();
11267
11277
  const {
11268
11278
  data: mutationOverTimeDataPerLocation,
11269
11279
  error,
@@ -11325,7 +11335,7 @@ const Toolbar = ({ colorScale, setColorScale, originalComponentProps }) => {
11325
11335
  const WastewaterMutationsOverTimeInfo = ({
11326
11336
  originalComponentProps
11327
11337
  }) => {
11328
- const lapis = x$1(LapisUrlContext);
11338
+ const lapis = useLapisUrl();
11329
11339
  return /* @__PURE__ */ u$1(Info, { children: [
11330
11340
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Info for mutations over time" }),
11331
11341
  /* @__PURE__ */ u$1(InfoParagraph, { children: /* @__PURE__ */ u$1("slot", { name: "infoText" }) }),
@@ -11409,42 +11419,48 @@ const getDatesForSelectorValue = (initialSelectedDateRange, dateRangeOptions, ea
11409
11419
  }
11410
11420
  return defaultDates;
11411
11421
  };
11412
- function computeInitialValues(initialValue, initialDateFrom, initialDateTo, earliestDate, dateRangeOptions) {
11422
+ function computeInitialValues(value, earliestDate, dateRangeOptions) {
11413
11423
  var _a;
11414
- if (isUndefinedOrEmpty(initialDateFrom) && isUndefinedOrEmpty(initialDateTo)) {
11424
+ if (value === void 0) {
11425
+ const { dateFrom: dateFrom2, dateTo: dateTo2 } = getDatesForSelectorValue(void 0, dateRangeOptions, earliestDate);
11426
+ return {
11427
+ initialSelectedDateRange: void 0,
11428
+ initialSelectedDateFrom: dateFrom2,
11429
+ initialSelectedDateTo: dateTo2
11430
+ };
11431
+ }
11432
+ if (typeof value === "string") {
11415
11433
  const selectableOptions = getSelectableOptions(dateRangeOptions);
11416
- const initialSelectedDateRange = (_a = selectableOptions.find((option) => option.value === initialValue)) == null ? void 0 : _a.value;
11417
- if (initialValue !== void 0 && initialSelectedDateRange === void 0) {
11434
+ const initialSelectedDateRange = (_a = selectableOptions.find((option) => option.value === value)) == null ? void 0 : _a.value;
11435
+ if (initialSelectedDateRange === void 0) {
11418
11436
  if (selectableOptions.length === 0) {
11419
- throw new UserFacingError(
11420
- "Invalid initialValue",
11421
- "There are no selectable options, but initialValue is set."
11422
- );
11437
+ throw new UserFacingError("Invalid value", "There are no selectable options, but value is set.");
11423
11438
  }
11424
11439
  throw new UserFacingError(
11425
- "Invalid initialValue",
11426
- `Invalid initialValue "${initialValue}", It must be one of ${selectableOptions.map((option) => `'${option.value}'`).join(", ")}`
11440
+ "Invalid value",
11441
+ `Invalid value "${value}", It must be one of ${selectableOptions.map((option) => `'${option.value}'`).join(", ")}`
11427
11442
  );
11428
11443
  }
11429
- const { dateFrom, dateTo } = getDatesForSelectorValue(initialSelectedDateRange, dateRangeOptions, earliestDate);
11444
+ const { dateFrom: dateFrom2, dateTo: dateTo2 } = getDatesForSelectorValue(initialSelectedDateRange, dateRangeOptions, earliestDate);
11430
11445
  return {
11431
11446
  initialSelectedDateRange,
11432
- initialSelectedDateFrom: dateFrom,
11433
- initialSelectedDateTo: dateTo
11447
+ initialSelectedDateFrom: dateFrom2,
11448
+ initialSelectedDateTo: dateTo2
11434
11449
  };
11435
11450
  }
11436
- const initialSelectedDateFrom = isUndefinedOrEmpty(initialDateFrom) ? new Date(earliestDate) : new Date(initialDateFrom);
11437
- let initialSelectedDateTo = isUndefinedOrEmpty(initialDateTo) ? /* @__PURE__ */ new Date() : new Date(initialDateTo);
11451
+ const { dateFrom, dateTo } = value;
11452
+ const initialSelectedDateFrom = isUndefinedOrEmpty(dateFrom) ? new Date(earliestDate) : new Date(dateFrom);
11453
+ let initialSelectedDateTo = isUndefinedOrEmpty(dateTo) ? /* @__PURE__ */ new Date() : new Date(dateTo);
11438
11454
  if (isNaN(initialSelectedDateFrom.getTime())) {
11439
11455
  throw new UserFacingError(
11440
- "Invalid initialDateFrom",
11441
- `Invalid initialDateFrom "${initialDateFrom}", It must be of the format YYYY-MM-DD`
11456
+ "Invalid value.dateFrom",
11457
+ `Invalid value.dateFrom "${dateFrom}", It must be of the format YYYY-MM-DD`
11442
11458
  );
11443
11459
  }
11444
11460
  if (isNaN(initialSelectedDateTo.getTime())) {
11445
11461
  throw new UserFacingError(
11446
- "Invalid initialDateTo",
11447
- `Invalid initialDateTo "${initialDateTo}", It must be of the format YYYY-MM-DD`
11462
+ "Invalid value.dateTo",
11463
+ `Invalid value.dateTo "${dateTo}", It must be of the format YYYY-MM-DD`
11448
11464
  );
11449
11465
  }
11450
11466
  if (initialSelectedDateFrom > initialSelectedDateTo) {
@@ -11463,9 +11479,7 @@ const customOption = "Custom";
11463
11479
  const dateRangeSelectorInnerPropsSchema = z$2.object({
11464
11480
  dateRangeOptions: z$2.array(dateRangeOptionSchema),
11465
11481
  earliestDate: z$2.string().date(),
11466
- initialValue: z$2.string().optional(),
11467
- initialDateFrom: z$2.string().date().optional(),
11468
- initialDateTo: z$2.string().date().optional(),
11482
+ value: dateRangeValueSchema.optional(),
11469
11483
  lapisDateField: z$2.string().min(1)
11470
11484
  });
11471
11485
  const dateRangeSelectorPropsSchema = dateRangeSelectorInnerPropsSchema.extend({
@@ -11479,17 +11493,12 @@ const DateRangeSelector = (props) => {
11479
11493
  const DateRangeSelectorInner = ({
11480
11494
  dateRangeOptions,
11481
11495
  earliestDate = "1900-01-01",
11482
- initialValue,
11483
- lapisDateField,
11484
- initialDateFrom,
11485
- initialDateTo
11496
+ value,
11497
+ lapisDateField
11486
11498
  }) => {
11487
- const initialValues = computeInitialValues(
11488
- initialValue,
11489
- initialDateFrom,
11490
- initialDateTo,
11491
- earliestDate,
11492
- dateRangeOptions
11499
+ const initialValues = T$1(
11500
+ () => computeInitialValues(value, earliestDate, dateRangeOptions),
11501
+ [value, earliestDate, dateRangeOptions]
11493
11502
  );
11494
11503
  const fromDatePickerRef = A$1(null);
11495
11504
  const toDatePickerRef = A$1(null);
@@ -11504,6 +11513,11 @@ const DateRangeSelectorInner = ({
11504
11513
  dateTo: initialValues.initialSelectedDateTo
11505
11514
  });
11506
11515
  y(() => {
11516
+ setSelectedDateRange(initialValues.initialSelectedDateRange);
11517
+ setSelectedDates({
11518
+ dateFrom: initialValues.initialSelectedDateFrom,
11519
+ dateTo: initialValues.initialSelectedDateTo
11520
+ });
11507
11521
  const commonConfig = {
11508
11522
  allowInput: true,
11509
11523
  dateFormat: "Y-m-d"
@@ -11512,7 +11526,7 @@ const DateRangeSelectorInner = ({
11512
11526
  setDateFromPicker(
11513
11527
  flatpickr(fromDatePickerRef.current, {
11514
11528
  ...commonConfig,
11515
- defaultDate: selectedDates.dateFrom
11529
+ defaultDate: initialValues.initialSelectedDateFrom
11516
11530
  })
11517
11531
  );
11518
11532
  }
@@ -11520,18 +11534,24 @@ const DateRangeSelectorInner = ({
11520
11534
  setDateToPicker(
11521
11535
  flatpickr(toDatePickerRef.current, {
11522
11536
  ...commonConfig,
11523
- defaultDate: selectedDates.dateTo
11537
+ defaultDate: initialValues.initialSelectedDateTo
11524
11538
  })
11525
11539
  );
11526
11540
  }
11527
11541
  return () => {
11528
- dateFromPicker == null ? void 0 : dateFromPicker.destroy();
11529
- dateToPicker == null ? void 0 : dateToPicker.destroy();
11542
+ setDateFromPicker((prev) => {
11543
+ prev == null ? void 0 : prev.destroy();
11544
+ return null;
11545
+ });
11546
+ setDateToPicker((prev) => {
11547
+ prev == null ? void 0 : prev.destroy();
11548
+ return null;
11549
+ });
11530
11550
  };
11531
- }, [fromDatePickerRef, toDatePickerRef]);
11532
- const onSelectChange = (value) => {
11533
- setSelectedDateRange(value);
11534
- const dateRange = getDatesForSelectorValue(value, dateRangeOptions, earliestDate);
11551
+ }, [fromDatePickerRef, toDatePickerRef, initialValues]);
11552
+ const onSelectChange = (value2) => {
11553
+ setSelectedDateRange(value2);
11554
+ const dateRange = getDatesForSelectorValue(value2, dateRangeOptions, earliestDate);
11535
11555
  dateToPicker == null ? void 0 : dateToPicker.set("minDate", dateRange.dateFrom);
11536
11556
  dateFromPicker == null ? void 0 : dateFromPicker.set("maxDate", dateRange.dateTo);
11537
11557
  dateFromPicker == null ? void 0 : dateFromPicker.setDate(dateRange.dateFrom);
@@ -11541,7 +11561,7 @@ const DateRangeSelectorInner = ({
11541
11561
  dateTo: dateRange.dateTo
11542
11562
  });
11543
11563
  fireFilterChangedEvent();
11544
- fireOptionChangedEvent(value);
11564
+ fireOptionChangedEvent(value2);
11545
11565
  };
11546
11566
  const onChangeDateFrom = () => {
11547
11567
  if (selectedDates.dateFrom.toDateString() === (dateFromPicker == null ? void 0 : dateFromPicker.selectedDates[0].toDateString())) {
@@ -11606,8 +11626,8 @@ const DateRangeSelectorInner = ({
11606
11626
  onChange: (event) => {
11607
11627
  event.preventDefault();
11608
11628
  const select = event.target;
11609
- const value = select.value;
11610
- onSelectChange(value);
11629
+ const value2 = select.value;
11630
+ onSelectChange(value2);
11611
11631
  }
11612
11632
  }
11613
11633
  ),
@@ -11652,9 +11672,7 @@ let DateRangeSelectorComponent = class extends PreactLitAdapter {
11652
11672
  super(...arguments);
11653
11673
  this.dateRangeOptions = [];
11654
11674
  this.earliestDate = "1900-01-01";
11655
- this.initialValue = void 0;
11656
- this.initialDateFrom = void 0;
11657
- this.initialDateTo = void 0;
11675
+ this.value = void 0;
11658
11676
  this.width = "100%";
11659
11677
  this.lapisDateField = "";
11660
11678
  }
@@ -11664,9 +11682,7 @@ let DateRangeSelectorComponent = class extends PreactLitAdapter {
11664
11682
  {
11665
11683
  dateRangeOptions: this.dateRangeOptions,
11666
11684
  earliestDate: this.earliestDate,
11667
- initialValue: this.initialValue,
11668
- initialDateFrom: this.initialDateFrom,
11669
- initialDateTo: this.initialDateTo,
11685
+ value: this.value,
11670
11686
  lapisDateField: this.lapisDateField,
11671
11687
  width: this.width
11672
11688
  }
@@ -11680,14 +11696,8 @@ __decorateClass$4([
11680
11696
  n$1({ type: String })
11681
11697
  ], DateRangeSelectorComponent.prototype, "earliestDate", 2);
11682
11698
  __decorateClass$4([
11683
- n$1()
11684
- ], DateRangeSelectorComponent.prototype, "initialValue", 2);
11685
- __decorateClass$4([
11686
- n$1()
11687
- ], DateRangeSelectorComponent.prototype, "initialDateFrom", 2);
11688
- __decorateClass$4([
11689
- n$1()
11690
- ], DateRangeSelectorComponent.prototype, "initialDateTo", 2);
11699
+ n$1({ type: Object })
11700
+ ], DateRangeSelectorComponent.prototype, "value", 2);
11691
11701
  __decorateClass$4([
11692
11702
  n$1({ type: String })
11693
11703
  ], DateRangeSelectorComponent.prototype, "width", 2);
@@ -14823,7 +14833,7 @@ const LocationFilter = (props) => {
14823
14833
  return /* @__PURE__ */ u$1(ErrorBoundary, { size, layout: "horizontal", componentProps: props, schema: locationFilterPropsSchema, children: /* @__PURE__ */ u$1(ResizeContainer, { size, children: /* @__PURE__ */ u$1(LocationFilterInner, { ...innerProps }) }) });
14824
14834
  };
14825
14835
  const LocationFilterInner = ({ value, fields, placeholderText, lapisFilter }) => {
14826
- const lapis = x$1(LapisUrlContext);
14836
+ const lapis = useLapisUrl();
14827
14837
  const { data, error, isLoading } = useQuery(
14828
14838
  () => fetchAutocompletionList({ fields, lapis, lapisFilter }),
14829
14839
  [fields, lapis, lapisFilter]
@@ -14991,7 +15001,7 @@ const TextInputInner = ({
14991
15001
  placeholderText,
14992
15002
  lapisFilter
14993
15003
  }) => {
14994
- const lapis = x$1(LapisUrlContext);
15004
+ const lapis = useLapisUrl();
14995
15005
  const { data, error, isLoading } = useQuery(
14996
15006
  () => fetchStringAutocompleteList({ lapis, field: lapisField, lapisFilter }),
14997
15007
  [lapisField, lapis, lapisFilter]
@@ -15190,12 +15200,13 @@ const QuickStart = () => {
15190
15200
  /* @__PURE__ */ u$1(ExampleMutation, { mutationType: "insertion", sequenceType: "amino acid" })
15191
15201
  ] })
15192
15202
  ] }) }),
15193
- referenceGenome.nucleotideSequences.length > 1 ? /* @__PURE__ */ u$1(InfoParagraph, { children: [
15203
+ referenceGenome.nucleotideSequences.length > 1 && /* @__PURE__ */ u$1(InfoParagraph, { children: [
15194
15204
  "This organism has the following segments:",
15195
15205
  " ",
15196
15206
  referenceGenome.nucleotideSequences.map((gene) => gene.name).join(", "),
15197
15207
  "."
15198
- ] }) : /* @__PURE__ */ u$1(InfoParagraph, { children: "This organism doesn't support nucleotide sequences." }),
15208
+ ] }),
15209
+ referenceGenome.nucleotideSequences.length === 0 && /* @__PURE__ */ u$1(InfoParagraph, { children: "This organism doesn't support nucleotide sequences." }),
15199
15210
  referenceGenome.genes.length !== 0 ? /* @__PURE__ */ u$1(InfoParagraph, { children: [
15200
15211
  "This organism has the following genes: ",
15201
15212
  referenceGenome.genes.map((gene) => gene.name).join(", "),
@@ -15838,7 +15849,7 @@ const LineageFilterInner = ({
15838
15849
  value,
15839
15850
  lapisFilter
15840
15851
  }) => {
15841
- const lapis = x$1(LapisUrlContext);
15852
+ const lapis = useLapisUrl();
15842
15853
  const { data, error, isLoading } = useQuery(
15843
15854
  () => fetchLineageAutocompleteList({ lapis, field: lapisField, lapisFilter }),
15844
15855
  [lapisField, lapis, lapisFilter]