col-browser 2.2.1 → 2.2.2

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.
package/README.md CHANGED
@@ -224,7 +224,7 @@ A [browsable taxonomic tree](https://www.catalogueoflife.org/data/browse). Compo
224
224
  1. `datasetKey` - the dataset key from the [Catalogue of Life ChecklistBank](https://www.checklistbank.org/).
225
225
  2. `expandedTaxonKey` - (Optional, controlled) which taxon the tree is expanded down to. Pair with `onExpandedTaxonKeyChange` to keep host state in sync.
226
226
  3. `onExpandedTaxonKeyChange` - (Optional) called with the new key when the user expands a different taxon.
227
- 4. `defaultTaxonKey` - (Optional, uncontrolled fallback) initial taxon to expand to when `expandedTaxonKey` is not provided.
227
+ 4. `defaultTaxonKey` - (Optional, uncontrolled fallback) initial taxon to expand to when `expandedTaxonKey` is not provided. Nothing is expanded unless one of these is set — pass a root id to open it on load, e.g. `defaultTaxonKey="CS5HF"` opens Eukaryota in current Catalogue of Life releases.
228
228
  5. `showTreeOptions` - (Optional) show toggles for extinct taxa and info (estimates, providers etc).
229
229
  6. `linkToSpeciesPage` - (Optional) when the searchbox finds a species or infraspecific taxon, jump directly to the taxon page rather than opening the tree.
230
230
  7. `citation` - (Optional) either `"top"` or `"bottom"`; include the necessary dataset citation above or below the tree component.
@@ -0,0 +1,24 @@
1
+ import { j as l } from "./jsx-runtime-BzflLqGi.js";
2
+ import n from "react";
3
+ import { c } from "./config-BPRXv9x8.js";
4
+ class m extends n.Component {
5
+ constructor(t) {
6
+ super(t), this.state = { error: !0, loading: !0 };
7
+ }
8
+ render() {
9
+ const { fallBack: t = null, datasetKey: e, sourceDatasetKey: r, style: s, size: o = "MEDIUM" } = this.props, { error: a, loading: i } = this.state;
10
+ return i || !a ? /* @__PURE__ */ l.jsx(
11
+ "img",
12
+ {
13
+ style: s,
14
+ src: `${c.dataApi}dataset/${e}/logo/source/${r}?size=${o}`,
15
+ onLoad: () => this.setState({ error: !1, loading: !1 }),
16
+ onError: () => this.setState({ error: !0, loading: !1 })
17
+ }
18
+ ) : t;
19
+ }
20
+ }
21
+ export {
22
+ m as D
23
+ };
24
+ //# sourceMappingURL=DatasetlogoWithFallback-B9WXvNCA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatasetlogoWithFallback-B9WXvNCA.js","sources":["../../src/components/DatasetlogoWithFallback.js"],"sourcesContent":["import React from \"react\";\nimport config from \"../config\";\n\nclass DatasetlogoWithFallback extends React.Component {\n constructor(props) {\n super(props);\n this.state = { error: true, loading: true };\n }\n render() {\n\n const {fallBack = null, datasetKey, sourceDatasetKey, style, size = 'MEDIUM'} = this.props;\n const {error, loading} = this.state;\n return (loading || !error) ?\n <img\n style={style}\n src={`${config.dataApi}dataset/${datasetKey}/logo/source/${sourceDatasetKey}?size=${size}`}\n onLoad={() => this.setState({error: false, loading: false})}\n onError={() => this.setState({error: true, loading: false})}\n /> : fallBack;\n \n ;\n }\n}\nexport default DatasetlogoWithFallback;"],"names":["DatasetlogoWithFallback","React","props","fallBack","datasetKey","sourceDatasetKey","style","size","error","loading","jsx","config"],"mappings":";;;AAGA,MAAMA,UAAgCC,EAAM,UAAU;AAAA,EACpD,YAAYC,GAAO;AACjB,UAAMA,CAAK,GACX,KAAK,QAAQ,EAAE,OAAO,IAAM,SAAS,GAAA;AAAA,EACvC;AAAA,EACA,SAAS;AAEL,UAAM,EAAC,UAAAC,IAAW,MAAM,YAAAC,GAAY,kBAAAC,GAAkB,OAAAC,GAAO,MAAAC,IAAO,aAAY,KAAK,OAC/E,EAAC,OAAAC,GAAO,SAAAC,EAAA,IAAW,KAAK;AAChC,WAAQA,KAAW,CAACD,IAChBE,gBAAAA,EAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAAJ;AAAA,QACA,KAAK,GAAGK,EAAO,OAAO,WAAWP,CAAU,gBAAgBC,CAAgB,SAASE,CAAI;AAAA,QACxF,QAAQ,MAAM,KAAK,SAAS,EAAC,OAAO,IAAO,SAAS,IAAM;AAAA,QAC1D,SAAS,MAAM,KAAK,SAAS,EAAC,OAAO,IAAM,SAAS,GAAA,CAAM;AAAA,MAAA;AAAA,IAAA,IACvDJ;AAAA,EAGX;AACF;"}