col-browser 2.2.1 → 2.2.3

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.
@@ -68681,7 +68681,10 @@ html body {
68681
68681
  rootTotal,
68682
68682
  rootLoading: false,
68683
68683
  treeData: [...this.state.treeData, ...treeData],
68684
- expandedKeys: treeData.length < 10 ? treeData.map((n2) => n2.taxon.id).filter((n2) => n2 === "CS5HF") : [],
68684
+ // Nothing is auto-expanded by default. Consumers open a specific root
68685
+ // (or deep taxon) by passing `defaultTaxonKey`/`expandedTaxonKey` —
68686
+ // e.g. defaultTaxonKey="CS5HF" opens Eukaryota in current COL releases.
68687
+ expandedKeys: [],
68685
68688
  error: null
68686
68689
  },
68687
68690
  () => {
@@ -77770,6 +77773,84 @@ html body {
77770
77773
  ] });
77771
77774
  }
77772
77775
  }
77776
+ const styles$1 = {
77777
+ tip: {
77778
+ color: "rgba(0,0,0,.45)",
77779
+ marginLeft: "4px"
77780
+ },
77781
+ icon: {
77782
+ marginTop: "4px"
77783
+ }
77784
+ };
77785
+ const Help = ({ title, classes }) => {
77786
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(React.Fragment, { children: title && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: classes.tip, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { title, getPopupContainer: () => document.getElementsByClassName(`catalogue-of-life`)[0], children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$k, { className: classes.icon }) }) }) });
77787
+ };
77788
+ const Help$1 = createWithStyles(styles$1)(Help);
77789
+ const styles = {
77790
+ formItem: {
77791
+ paddingBottom: 0,
77792
+ width: "100%",
77793
+ clear: "both",
77794
+ borderBottom: "1px solid #eee",
77795
+ "&:last-of-type": {
77796
+ border: "none"
77797
+ },
77798
+ "&>div": {
77799
+ paddingLeft: 10,
77800
+ paddingRight: 10
77801
+ }
77802
+ },
77803
+ label: {
77804
+ display: "block",
77805
+ color: "rgba(0, 0, 0, 0.85)"
77806
+ },
77807
+ content: {
77808
+ wordBreak: "break-word",
77809
+ marginBottom: 0
77810
+ },
77811
+ noContent: {
77812
+ wordBreak: "break-word",
77813
+ color: "#bbb",
77814
+ marginBottom: 0
77815
+ },
77816
+ contentCol: {
77817
+ wordBreak: "break-word"
77818
+ },
77819
+ smallMargin: {
77820
+ marginBottom: 3,
77821
+ marginTop: 3
77822
+ },
77823
+ mediumMargin: {
77824
+ marginBottom: 10,
77825
+ marginTop: 10
77826
+ }
77827
+ };
77828
+ const PresentationItem = ({ label, helpText, classes, children, width, md: md2, size }) => {
77829
+ const getValue2 = () => {
77830
+ let value;
77831
+ if (Array.isArray(children) && children.length > 0) {
77832
+ value = children.map((item, i) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: classes.content, children: item }, i));
77833
+ } else if (!Array.isArray(children) && typeof children !== "undefined") {
77834
+ value = /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: classes.content, children });
77835
+ }
77836
+ return value;
77837
+ };
77838
+ const medium = md2 || 8;
77839
+ const mediumCol2 = medium < 24 ? 24 - medium : 24;
77840
+ const marginSize = size === "medium" ? classes.mediumMargin : classes.smallMargin;
77841
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(Row, { className: classes.formItem, children: [
77842
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { sm: 24, md: medium, style: width < MEDIUM ? { marginBottom: 0 } : {}, className: marginSize, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("dt", { className: classes.label, children: [
77843
+ label,
77844
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Help$1, { title: helpText })
77845
+ ] }) }) }),
77846
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { sm: 24, md: mediumCol2, style: width < MEDIUM ? { marginTop: 0 } : {}, className: marginSize, children: getValue2() })
77847
+ ] });
77848
+ };
77849
+ PresentationItem.propTypes = {
77850
+ label: PropTypes.string.isRequired,
77851
+ helpText: PropTypes.object
77852
+ };
77853
+ const PresentationItem$1 = withWidth()(createWithStyles(styles)(PresentationItem));
77773
77854
  const INFRASPECIFIC_RANKS = [
77774
77855
  "subspecies",
77775
77856
  "variety",
@@ -78973,7 +79054,9 @@ html body {
78973
79054
  showDistributionMap,
78974
79055
  focalTaxon,
78975
79056
  rankOrder,
78976
- gbifChecklistKey
79057
+ gbifChecklistKey,
79058
+ label,
79059
+ md: md2
78977
79060
  }) => {
78978
79061
  const mappable = data.filter(isMappable);
78979
79062
  const baseUnmappable = data.length - mappable.length;
@@ -79014,56 +79097,58 @@ html body {
79014
79097
  const gbifAvailable = !hasGbifConfigured ? false : gbifCount === null || gbifCount > 0;
79015
79098
  const allMappableFailed = mappable.length > 0 && fetchFailures >= mappable.length;
79016
79099
  const showMap = showDistributionMap && (mappable.length > 0 || gbifAvailable) && !(mappable.length > 0 && allMappableFailed && !gbifAvailable);
79017
- if (!showMap && hasGbifConfigured && mappable.length === 0 && gbifCount === 0) {
79018
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: style2, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { color: "#888" }, children: "No occurrence data on GBIF for this taxon." }) });
79019
- }
79020
- if (!showMap) {
79021
- if (!hasAnyRecords) return null;
79022
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: style2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ListView, { datasetKey, data }) });
79023
- }
79100
+ if (!showMap && !hasAnyRecords) return null;
79024
79101
  const unmappable = baseUnmappable + fetchFailures;
79025
79102
  const showToggle = hasAnyRecords;
79026
- const activeView = showToggle ? view : "map";
79027
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: style2, children: [
79028
- showToggle ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
79029
- Radio.Group,
79030
- {
79031
- size: "small",
79032
- value: activeView,
79033
- onChange: (e2) => setView(e2.target.value),
79034
- style: { marginBottom: 8 },
79035
- children: [
79036
- /* @__PURE__ */ jsxRuntimeExports.jsx(Radio.Button, { value: "map", children: "Map" }),
79037
- /* @__PURE__ */ jsxRuntimeExports.jsx(Radio.Button, { value: "list", children: "List" })
79038
- ]
79039
- }
79040
- ) : (
79041
- // Reserve the vertical space the Map/List toggle would occupy so the
79042
- // map's top edge lines up with the "Distributions" label.
79043
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { height: 24, marginBottom: 8 } })
79044
- ),
79045
- activeView === "map" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
79046
- /* @__PURE__ */ jsxRuntimeExports.jsx(
79047
- DistributionsMap,
79103
+ let body;
79104
+ if (!showMap) {
79105
+ body = /* @__PURE__ */ jsxRuntimeExports.jsx(ListView, { datasetKey, data });
79106
+ } else {
79107
+ const activeView = showToggle ? view : "map";
79108
+ body = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
79109
+ showToggle ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
79110
+ Radio.Group,
79048
79111
  {
79049
- records: mappable,
79050
- onUnmappable: setFetchFailures,
79051
- datasetKey,
79052
- focalTaxon,
79053
- rankOrder,
79054
- gbifChecklistKey,
79055
- gbifAvailable
79112
+ size: "small",
79113
+ value: activeView,
79114
+ onChange: (e2) => setView(e2.target.value),
79115
+ style: { marginBottom: 8 },
79116
+ children: [
79117
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Radio.Button, { value: "map", children: "Map" }),
79118
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Radio.Button, { value: "list", children: "List" })
79119
+ ]
79056
79120
  }
79121
+ ) : (
79122
+ // Reserve the vertical space the Map/List toggle would occupy so the
79123
+ // map's top edge lines up with the "Distributions" label.
79124
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { height: 24, marginBottom: 8 } })
79057
79125
  ),
79058
- showToggle && unmappable > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { marginTop: 6 }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("a", { onClick: () => setView("list"), style: { cursor: "pointer" }, children: [
79059
- "+",
79060
- unmappable,
79061
- " distribution",
79062
- unmappable === 1 ? "" : "s",
79063
- " not on map"
79064
- ] }) })
79065
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ListView, { datasetKey, data })
79066
- ] });
79126
+ activeView === "map" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
79127
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
79128
+ DistributionsMap,
79129
+ {
79130
+ records: mappable,
79131
+ onUnmappable: setFetchFailures,
79132
+ datasetKey,
79133
+ focalTaxon,
79134
+ rankOrder,
79135
+ gbifChecklistKey,
79136
+ gbifAvailable
79137
+ }
79138
+ ),
79139
+ showToggle && unmappable > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { marginTop: 6 }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("a", { onClick: () => setView("list"), style: { cursor: "pointer" }, children: [
79140
+ "+",
79141
+ unmappable,
79142
+ " distribution",
79143
+ unmappable === 1 ? "" : "s",
79144
+ " not on map"
79145
+ ] }) })
79146
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ListView, { datasetKey, data })
79147
+ ] });
79148
+ }
79149
+ const mapNudge = label && showMap ? { marginTop: -3 } : null;
79150
+ const content = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { ...mapNudge, ...style2 }, children: body });
79151
+ return label ? /* @__PURE__ */ jsxRuntimeExports.jsx(PresentationItem$1, { md: md2, label, children: content }) : content;
79067
79152
  };
79068
79153
  const rankStyle = {
79069
79154
  color: "rgba(0, 0, 0, 0.45)",
@@ -79080,84 +79165,6 @@ html body {
79080
79165
  i < data.length - 1 && " >"
79081
79166
  ] }, t2.rank))
79082
79167
  ] });
79083
- const styles$1 = {
79084
- tip: {
79085
- color: "rgba(0,0,0,.45)",
79086
- marginLeft: "4px"
79087
- },
79088
- icon: {
79089
- marginTop: "4px"
79090
- }
79091
- };
79092
- const Help = ({ title, classes }) => {
79093
- return /* @__PURE__ */ jsxRuntimeExports.jsx(React.Fragment, { children: title && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: classes.tip, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { title, getPopupContainer: () => document.getElementsByClassName(`catalogue-of-life`)[0], children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$k, { className: classes.icon }) }) }) });
79094
- };
79095
- const Help$1 = createWithStyles(styles$1)(Help);
79096
- const styles = {
79097
- formItem: {
79098
- paddingBottom: 0,
79099
- width: "100%",
79100
- clear: "both",
79101
- borderBottom: "1px solid #eee",
79102
- "&:last-of-type": {
79103
- border: "none"
79104
- },
79105
- "&>div": {
79106
- paddingLeft: 10,
79107
- paddingRight: 10
79108
- }
79109
- },
79110
- label: {
79111
- display: "block",
79112
- color: "rgba(0, 0, 0, 0.85)"
79113
- },
79114
- content: {
79115
- wordBreak: "break-word",
79116
- marginBottom: 0
79117
- },
79118
- noContent: {
79119
- wordBreak: "break-word",
79120
- color: "#bbb",
79121
- marginBottom: 0
79122
- },
79123
- contentCol: {
79124
- wordBreak: "break-word"
79125
- },
79126
- smallMargin: {
79127
- marginBottom: 3,
79128
- marginTop: 3
79129
- },
79130
- mediumMargin: {
79131
- marginBottom: 10,
79132
- marginTop: 10
79133
- }
79134
- };
79135
- const PresentationItem = ({ label, helpText, classes, children, width, md: md2, size }) => {
79136
- const getValue2 = () => {
79137
- let value;
79138
- if (Array.isArray(children) && children.length > 0) {
79139
- value = children.map((item, i) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: classes.content, children: item }, i));
79140
- } else if (!Array.isArray(children) && typeof children !== "undefined") {
79141
- value = /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: classes.content, children });
79142
- }
79143
- return value;
79144
- };
79145
- const medium = md2 || 8;
79146
- const mediumCol2 = medium < 24 ? 24 - medium : 24;
79147
- const marginSize = size === "medium" ? classes.mediumMargin : classes.smallMargin;
79148
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(Row, { className: classes.formItem, children: [
79149
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { sm: 24, md: medium, style: width < MEDIUM ? { marginBottom: 0 } : {}, className: marginSize, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("dt", { className: classes.label, children: [
79150
- label,
79151
- /* @__PURE__ */ jsxRuntimeExports.jsx(Help$1, { title: helpText })
79152
- ] }) }) }),
79153
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { sm: 24, md: mediumCol2, style: width < MEDIUM ? { marginTop: 0 } : {}, className: marginSize, children: getValue2() })
79154
- ] });
79155
- };
79156
- PresentationItem.propTypes = {
79157
- label: PropTypes.string.isRequired,
79158
- helpText: PropTypes.object
79159
- };
79160
- const PresentationItem$1 = withWidth()(createWithStyles(styles)(PresentationItem));
79161
79168
  const getLabel = (r2, reverse) => {
79162
79169
  if (!reverse) {
79163
79170
  switch (r2.type) {
@@ -87571,10 +87578,14 @@ html body {
87571
87578
  datasetKey: taxon.datasetKey
87572
87579
  }
87573
87580
  ) }),
87574
- (get(info, "distributions") || showDistributionMap && gbifChecklistKey && taxon) && /* @__PURE__ */ jsxRuntimeExports.jsx(PresentationItem$1, { md, label: "Distributions", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
87581
+ (get(info, "distributions") || showDistributionMap && gbifChecklistKey && taxon) && // Distributions owns its labelled block so it can hide entirely
87582
+ // (label included) when there is nothing to show — including after
87583
+ // the async GBIF occurrence lookup comes back empty.
87584
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
87575
87585
  DistributionsTable,
87576
87586
  {
87577
- style: { marginTop: "-3px" },
87587
+ label: "Distributions",
87588
+ md,
87578
87589
  data: (info == null ? void 0 : info.distributions) || [],
87579
87590
  datasetKey,
87580
87591
  showDistributionMap,
@@ -87582,7 +87593,7 @@ html body {
87582
87593
  rankOrder: rank,
87583
87594
  gbifChecklistKey
87584
87595
  }
87585
- ) }),
87596
+ ),
87586
87597
  get(taxon, "environments") && /* @__PURE__ */ jsxRuntimeExports.jsx(PresentationItem$1, { md, label: "Environment(s)", children: get(taxon, "environments").join(", ") }),
87587
87598
  get(taxon, "remarks") && /* @__PURE__ */ jsxRuntimeExports.jsx(PresentationItem$1, { md, label: "Additional Data", children: taxon.remarks }),
87588
87599
  /* @__PURE__ */ jsxRuntimeExports.jsx(Row, { children: get(taxon, "accordingTo") && /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: 12, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(PresentationItem$1, { md: md * 2, label: "According to", children: [