UNPKG

@macrostrat/column-components

Version:

React rendering primitives for stratigraphic columns

75 lines (67 loc) 2.51 kB
import {FaciesContext as $h1RZx$FaciesContext} from "./column-components.fa405a9f.js"; import {Component as $h1RZx$Component} from "react"; import $h1RZx$macrostrathyper from "@macrostrat/hyper"; import {SwatchesPicker as $h1RZx$SwatchesPicker} from "react-color"; import {Popover as $h1RZx$Popover} from "@blueprintjs/core"; /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * DS206: Consider reworking classes to avoid initClass * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ class $513054fd2f38b672$var$FaciesColorPicker extends (0, $h1RZx$Component) { static{ this.contextType = (0, $h1RZx$FaciesContext); } render() { const { setFaciesColor: setFaciesColor } = this.context; const { facies: d } = this.props; return (0, $h1RZx$macrostrathyper)("div", [ (0, $h1RZx$macrostrathyper)((0, $h1RZx$SwatchesPicker), { color: d.color || "black", onChangeComplete (color) { return setFaciesColor(d.id, color.hex); }, styles: { width: 500, height: 570 } }) ]); } } const $513054fd2f38b672$export$601edd34af742364 = ({ facies: d, ...rest })=>(0, $h1RZx$macrostrathyper)("div.color-swatch", { style: { backgroundColor: d.color || "black", width: "2em", height: "2em" }, ...rest }); class $513054fd2f38b672$export$a3eca1b02e3b1d92 extends (0, $h1RZx$Component) { static{ this.defaultProps = { isEditable: true, facies: null }; } constructor(props){ super(props); } render() { const { facies: facies, isEditable: isEditable } = this.props; const basic = (0, $h1RZx$macrostrathyper)($513054fd2f38b672$export$601edd34af742364, { facies: facies }); if (!isEditable) return basic; return (0, $h1RZx$macrostrathyper)((0, $h1RZx$Popover), { }, [ basic, (0, $h1RZx$macrostrathyper)($513054fd2f38b672$var$FaciesColorPicker, { facies: facies }) ]); } } export {$513054fd2f38b672$export$601edd34af742364 as BasicFaciesSwatch, $513054fd2f38b672$export$a3eca1b02e3b1d92 as FaciesSwatch}; //# sourceMappingURL=column-components.d5938d25.js.map