UNPKG

@wordpress/components

Version:
24 lines (23 loc) • 926 B
import CustomGradientBar from "../custom-gradient-picker/gradient-bar/index.mjs"; import { getColorStopsFromColors, getColorsFromColorStops, getGradientFromCSSColors } from "./utils.mjs"; import { jsx } from "react/jsx-runtime"; // packages/components/src/duotone-picker/custom-duotone-bar.tsx const PLACEHOLDER_VALUES = ["#333", "#CCC"]; function CustomDuotoneBar({ value, onChange }) { const hasGradient = !!value; const values = hasGradient ? value : PLACEHOLDER_VALUES; const background = getGradientFromCSSColors(values); const controlPoints = getColorStopsFromColors(values); return /* @__PURE__ */ jsx(CustomGradientBar, { disableInserter: true, disablePositioning: true, background, hasGradient, value: controlPoints, onChange: (newColorStops) => { onChange(getColorsFromColorStops(newColorStops)); } }); } export { CustomDuotoneBar as default }; //# sourceMappingURL=custom-duotone-bar.mjs.map