UNPKG

@wordpress/components

Version:
29 lines (28 loc) 937 B
import { createElement } from "@wordpress/element"; /** * Internal dependencies */ import CustomGradientBar from '../custom-gradient-picker/gradient-bar'; import { getColorStopsFromColors, getGradientFromCSSColors, getColorsFromColorStops } from './utils'; const PLACEHOLDER_VALUES = ['#333', '#CCC']; export default function CustomDuotoneBar(_ref) { let { value, onChange } = _ref; const hasGradient = !!value; const values = hasGradient ? value : PLACEHOLDER_VALUES; const background = getGradientFromCSSColors(values); const controlPoints = getColorStopsFromColors(values); return createElement(CustomGradientBar, { disableInserter: true, background: background, hasGradient: hasGradient, value: controlPoints, onChange: newColorStops => { const newValue = getColorsFromColorStops(newColorStops); onChange(newValue); } }); } //# sourceMappingURL=custom-duotone-bar.js.map