geostyler
Version:
Framework for styling geodata
50 lines (49 loc) • 1.19 kB
JavaScript
import { jsx as l } from "react/jsx-runtime";
/* empty css */
import { brewer as F } from "chroma-js";
import { Select as c } from "antd";
import s from "../../../Util/RuleGeneratorUtil.js";
import { useGeoStylerLocale as d } from "../../../context/GeoStylerContext/GeoStylerContext.js";
const h = ({
colorRamps: e = {
GeoStyler: ["#E7000E", "#F48E00", "#FFED00", "#00943D", "#272C82", "#611E82"],
GreenRed: ["#00FF00", "#FF0000"],
...F
},
onChange: m,
colorRamp: r
}) => {
const n = d("ColorRampCombo"), p = Object.keys(e).map((o) => {
const a = e[o], i = s.generateBackgroundStyleFromColors(a);
return /* @__PURE__ */ l(
c.Option,
{
className: "gs-color-ramp-option",
value: o,
style: i,
children: o
},
o
);
});
let t;
if (r) {
const o = e[r];
t = s.generateBackgroundStyleFromColors(o);
}
return /* @__PURE__ */ l(
c,
{
className: "gs-color-ramp-select",
style: t,
placeholder: n.colorRampPlaceholder,
optionFilterProp: "children",
value: r,
onChange: m,
children: p
}
);
};
export {
h as ColorRampCombo
};