UNPKG

@macrostrat/column-components

Version:

React rendering primitives for stratigraphic columns

66 lines (57 loc) 2.14 kB
import {FaciesContext as $h1RZx$FaciesContext} from "./column-components.0ccab336.js"; import {Component as $h1RZx$Component} from "react"; import $h1RZx$macrostrathyper from "@macrostrat/hyper"; import $h1RZx$uiwreactcolorswatch from "@uiw/react-color-swatch"; import {Popover as $h1RZx$Popover} from "@blueprintjs/core"; 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$uiwreactcolorswatch), { color: d.color || "black", onChange (color) { return setFaciesColor(d.id, color.hex); } }) ]); } } 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.28b49b3b.js.map