col-browser 2.2.2 → 2.2.4

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.
@@ -3,7 +3,7 @@ import { j as i } from "./chunks/jsx-runtime-BzflLqGi.js";
3
3
  import { useState as s, useEffect as $ } from "react";
4
4
  import { s as D, c as l, R as T, b as g } from "./chunks/router-CssZk5qZ.js";
5
5
  import { Row as k, Col as v, Spin as w } from "antd";
6
- import { D as A } from "./chunks/Distributions-Cwl_75VG.js";
6
+ import { D as A } from "./chunks/Distributions-BWucAjsL.js";
7
7
  const C = ({
8
8
  taxonId: o,
9
9
  datasetKey: n,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "col-browser",
3
- "version": "2.2.2",
3
+ "version": "2.2.4",
4
4
  "description": "Catalogue of Life browse and search React components",
5
5
  "main": "umd/col-browser.js",
6
6
  "module": "es/index.js",
@@ -104,7 +104,7 @@
104
104
  "terser": "^5.48.0",
105
105
  "typescript": "^6.0.0",
106
106
  "vite": "^6.4.2",
107
- "vitest": "^3.2.4"
107
+ "vitest": "^4.1.8"
108
108
  },
109
109
  "author": "",
110
110
  "homepage": "",
@@ -78246,6 +78246,7 @@ html body {
78246
78246
  }) => {
78247
78247
  var _a2;
78248
78248
  const containerRef = reactExports.useRef(null);
78249
+ const wrapperRef = reactExports.useRef(null);
78249
78250
  const mapRef = reactExports.useRef(null);
78250
78251
  const popupRef = reactExports.useRef(null);
78251
78252
  const recordMapRef = reactExports.useRef(/* @__PURE__ */ new Map());
@@ -78347,6 +78348,10 @@ html body {
78347
78348
  new maplibregl.NavigationControl({ showCompass: false }),
78348
78349
  "top-left"
78349
78350
  );
78351
+ map.addControl(
78352
+ new maplibregl.FullscreenControl({ container: wrapperRef.current }),
78353
+ "top-right"
78354
+ );
78350
78355
  mapRef.current = map;
78351
78356
  map.on("load", () => {
78352
78357
  setStyleReady(true);
@@ -78735,93 +78740,102 @@ html body {
78735
78740
  );
78736
78741
  }
78737
78742
  const focalName = ((_a2 = focalTaxon == null ? void 0 : focalTaxon.name) == null ? void 0 : _a2.scientificName) || "This taxon";
78738
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "col-distributions-map", style: { position: "relative" }, children: [
78739
- /* @__PURE__ */ jsxRuntimeExports.jsx(
78740
- "div",
78741
- {
78742
- ref: containerRef,
78743
- style: { height: 360, width: "100%", background: "#f5f5f5" }
78744
- }
78745
- ),
78746
- /* @__PURE__ */ jsxRuntimeExports.jsx(
78747
- LayerControl,
78748
- {
78749
- open: controlOpen,
78750
- onOpen: openControl,
78751
- onClose: () => setControlOpen(false),
78752
- focalName,
78753
- focalReady,
78754
- focalVisible,
78755
- onToggleFocal: () => setFocalVisible((v2) => !v2),
78756
- gbifEnabled: !!gbifChecklistKey,
78757
- gbifVisible,
78758
- gbifAvailable,
78759
- onToggleGbif: handleToggleGbif,
78760
- descendantStatus: descendantState.status,
78761
- descendantsByRank,
78762
- descendantColors,
78763
- visibleTaxonIds,
78764
- onToggleTaxon: toggleTaxon,
78765
- onToggleRankGroup: toggleRankGroup,
78766
- onRetry: () => {
78767
- fetchTriggeredRef.current = false;
78768
- setDescendantState({ status: "idle", taxa: [] });
78769
- triggerDescendantFetch();
78770
- }
78771
- }
78772
- ),
78773
- !showDescendantLegend && (presentMeans.length > 0 || gbifChecklistKey && gbifAvailable !== false && gbifVisible) && /* @__PURE__ */ jsxRuntimeExports.jsxs(
78774
- "div",
78775
- {
78776
- style: {
78777
- position: "absolute",
78778
- bottom: 8,
78779
- left: 8,
78780
- zIndex: 1,
78781
- background: "#fff",
78782
- borderRadius: 4,
78783
- boxShadow: "0 1px 4px rgba(0,0,0,0.2)",
78784
- padding: "6px 8px",
78785
- fontSize: 12,
78786
- lineHeight: 1.5
78787
- },
78788
- children: [
78789
- presentMeans.map((m2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
78790
- "div",
78791
- {
78792
- style: { display: "flex", alignItems: "center", gap: 6 },
78793
- children: [
78794
- /* @__PURE__ */ jsxRuntimeExports.jsx(
78795
- "span",
78796
- {
78797
- style: {
78798
- display: "inline-block",
78799
- width: 12,
78800
- height: 12,
78801
- background: m2.color,
78802
- border: "1px solid rgba(0,0,0,0.15)",
78803
- borderRadius: 2
78804
- }
78805
- }
78806
- ),
78807
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: m2.label })
78808
- ]
78743
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
78744
+ "div",
78745
+ {
78746
+ className: "col-distributions-map",
78747
+ ref: wrapperRef,
78748
+ style: { position: "relative" },
78749
+ children: [
78750
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
78751
+ "div",
78752
+ {
78753
+ ref: containerRef,
78754
+ className: "col-distributions-map__canvas",
78755
+ style: { height: 360, width: "100%", background: "#f5f5f5" }
78756
+ }
78757
+ ),
78758
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
78759
+ LayerControl,
78760
+ {
78761
+ open: controlOpen,
78762
+ onOpen: openControl,
78763
+ onClose: () => setControlOpen(false),
78764
+ focalName,
78765
+ focalReady,
78766
+ focalVisible,
78767
+ onToggleFocal: () => setFocalVisible((v2) => !v2),
78768
+ gbifEnabled: !!gbifChecklistKey,
78769
+ gbifVisible,
78770
+ gbifAvailable,
78771
+ onToggleGbif: handleToggleGbif,
78772
+ descendantStatus: descendantState.status,
78773
+ descendantsByRank,
78774
+ descendantColors,
78775
+ visibleTaxonIds,
78776
+ onToggleTaxon: toggleTaxon,
78777
+ onToggleRankGroup: toggleRankGroup,
78778
+ onRetry: () => {
78779
+ fetchTriggeredRef.current = false;
78780
+ setDescendantState({ status: "idle", taxa: [] });
78781
+ triggerDescendantFetch();
78782
+ }
78783
+ }
78784
+ ),
78785
+ !showDescendantLegend && (presentMeans.length > 0 || gbifChecklistKey && gbifAvailable !== false && gbifVisible) && /* @__PURE__ */ jsxRuntimeExports.jsxs(
78786
+ "div",
78787
+ {
78788
+ style: {
78789
+ position: "absolute",
78790
+ bottom: 8,
78791
+ left: 8,
78792
+ zIndex: 1,
78793
+ background: "#fff",
78794
+ borderRadius: 4,
78795
+ boxShadow: "0 1px 4px rgba(0,0,0,0.2)",
78796
+ padding: "6px 8px",
78797
+ fontSize: 12,
78798
+ lineHeight: 1.5
78809
78799
  },
78810
- m2.key
78811
- )),
78812
- gbifChecklistKey && gbifAvailable !== false && gbifVisible && /* @__PURE__ */ jsxRuntimeExports.jsx(GbifLegendEntry, {})
78813
- ]
78814
- }
78815
- ),
78816
- showDescendantLegend && /* @__PURE__ */ jsxRuntimeExports.jsx(
78817
- IncludedTaxaLegend,
78818
- {
78819
- visibleGroups: descendantLegend.visibleGroups,
78820
- unmappableGroups: descendantLegend.unmappableGroups,
78821
- showGbif: !!gbifChecklistKey && gbifAvailable !== false && gbifVisible
78822
- }
78823
- )
78824
- ] });
78800
+ children: [
78801
+ presentMeans.map((m2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
78802
+ "div",
78803
+ {
78804
+ style: { display: "flex", alignItems: "center", gap: 6 },
78805
+ children: [
78806
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
78807
+ "span",
78808
+ {
78809
+ style: {
78810
+ display: "inline-block",
78811
+ width: 12,
78812
+ height: 12,
78813
+ background: m2.color,
78814
+ border: "1px solid rgba(0,0,0,0.15)",
78815
+ borderRadius: 2
78816
+ }
78817
+ }
78818
+ ),
78819
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: m2.label })
78820
+ ]
78821
+ },
78822
+ m2.key
78823
+ )),
78824
+ gbifChecklistKey && gbifAvailable !== false && gbifVisible && /* @__PURE__ */ jsxRuntimeExports.jsx(GbifLegendEntry, {})
78825
+ ]
78826
+ }
78827
+ ),
78828
+ showDescendantLegend && /* @__PURE__ */ jsxRuntimeExports.jsx(
78829
+ IncludedTaxaLegend,
78830
+ {
78831
+ visibleGroups: descendantLegend.visibleGroups,
78832
+ unmappableGroups: descendantLegend.unmappableGroups,
78833
+ showGbif: !!gbifChecklistKey && gbifAvailable !== false && gbifVisible
78834
+ }
78835
+ )
78836
+ ]
78837
+ }
78838
+ );
78825
78839
  };
78826
78840
  const LayerControl = ({
78827
78841
  open: open2,
@@ -78853,7 +78867,8 @@ html body {
78853
78867
  title: "Layers",
78854
78868
  style: {
78855
78869
  position: "absolute",
78856
- top: 10,
78870
+ // Sits just below the maplibre fullscreen control (top-right).
78871
+ top: 48,
78857
78872
  right: 10,
78858
78873
  zIndex: 2,
78859
78874
  width: 30,
@@ -78876,7 +78891,8 @@ html body {
78876
78891
  {
78877
78892
  style: {
78878
78893
  position: "absolute",
78879
- top: 10,
78894
+ // Aligns with the collapsed "+" button, below the fullscreen control.
78895
+ top: 48,
78880
78896
  right: 10,
78881
78897
  zIndex: 2,
78882
78898
  background: "#fff",
@@ -79100,48 +79116,52 @@ html body {
79100
79116
  if (!showMap && !hasAnyRecords) return null;
79101
79117
  const unmappable = baseUnmappable + fetchFailures;
79102
79118
  const showToggle = hasAnyRecords;
79103
- const activeView = showMap && showToggle ? view : showMap ? "map" : "list";
79104
- const body = activeView === "map" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
79105
- showToggle ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
79106
- Radio.Group,
79107
- {
79108
- size: "small",
79109
- value: view,
79110
- onChange: (e2) => setView(e2.target.value),
79111
- style: { marginBottom: 8 },
79112
- children: [
79113
- /* @__PURE__ */ jsxRuntimeExports.jsx(Radio.Button, { value: "map", children: "Map" }),
79114
- /* @__PURE__ */ jsxRuntimeExports.jsx(Radio.Button, { value: "list", children: "List" })
79115
- ]
79116
- }
79117
- ) : (
79118
- // Reserve the vertical space the Map/List toggle would occupy so the
79119
- // map's top edge lines up with the "Distributions" label.
79120
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { height: 24, marginBottom: 8 } })
79121
- ),
79122
- /* @__PURE__ */ jsxRuntimeExports.jsx(
79123
- DistributionsMap,
79124
- {
79125
- records: mappable,
79126
- onUnmappable: setFetchFailures,
79127
- datasetKey,
79128
- focalTaxon,
79129
- rankOrder,
79130
- gbifChecklistKey,
79131
- gbifAvailable
79132
- }
79133
- ),
79134
- showToggle && unmappable > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { marginTop: 6 }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("a", { onClick: () => setView("list"), style: { cursor: "pointer" }, children: [
79135
- "+",
79136
- unmappable,
79137
- " distribution",
79138
- unmappable === 1 ? "" : "s",
79139
- " not on map"
79140
- ] }) })
79141
- ] }) : (
79142
- // List view: either the user toggled to it, or there is no map to show.
79143
- /* @__PURE__ */ jsxRuntimeExports.jsx(ListView, { datasetKey, data })
79144
- );
79119
+ let body;
79120
+ if (!showMap) {
79121
+ body = /* @__PURE__ */ jsxRuntimeExports.jsx(ListView, { datasetKey, data });
79122
+ } else {
79123
+ const activeView = showToggle ? view : "map";
79124
+ body = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
79125
+ showToggle ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
79126
+ Radio.Group,
79127
+ {
79128
+ size: "small",
79129
+ value: activeView,
79130
+ onChange: (e2) => setView(e2.target.value),
79131
+ style: { marginBottom: 8 },
79132
+ children: [
79133
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Radio.Button, { value: "map", children: "Map" }),
79134
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Radio.Button, { value: "list", children: "List" })
79135
+ ]
79136
+ }
79137
+ ) : (
79138
+ // Reserve the vertical space the Map/List toggle would occupy so the
79139
+ // map's top edge lines up with the "Distributions" label.
79140
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { height: 24, marginBottom: 8 } })
79141
+ ),
79142
+ activeView === "map" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
79143
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
79144
+ DistributionsMap,
79145
+ {
79146
+ records: mappable,
79147
+ onUnmappable: setFetchFailures,
79148
+ datasetKey,
79149
+ focalTaxon,
79150
+ rankOrder,
79151
+ gbifChecklistKey,
79152
+ gbifAvailable
79153
+ }
79154
+ ),
79155
+ showToggle && unmappable > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { marginTop: 6 }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("a", { onClick: () => setView("list"), style: { cursor: "pointer" }, children: [
79156
+ "+",
79157
+ unmappable,
79158
+ " distribution",
79159
+ unmappable === 1 ? "" : "s",
79160
+ " not on map"
79161
+ ] }) })
79162
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ListView, { datasetKey, data })
79163
+ ] });
79164
+ }
79145
79165
  const content = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: style2, children: body });
79146
79166
  return label ? /* @__PURE__ */ jsxRuntimeExports.jsx(PresentationItem$1, { md: md2, label, children: content }) : content;
79147
79167
  };
@@ -87579,7 +87599,6 @@ html body {
87579
87599
  /* @__PURE__ */ jsxRuntimeExports.jsx(
87580
87600
  DistributionsTable,
87581
87601
  {
87582
- style: { marginTop: "-3px" },
87583
87602
  label: "Distributions",
87584
87603
  md,
87585
87604
  data: (info == null ? void 0 : info.distributions) || [],