@gechiui/block-editor
Version:
32 lines (29 loc) • 1.05 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import { createElement } from "@gechiui/element";
/**
* External dependencies
*/
import { isEmpty } from 'lodash';
/**
* GeChiUI dependencies
*/
import { createHigherOrderComponent } from '@gechiui/compose';
/**
* Internal dependencies
*/
import useSetting from '../use-setting';
export default createHigherOrderComponent(WrappedComponent => {
return props => {
const colorsFeature = useSetting('color.palette');
const disableCustomColorsFeature = !useSetting('color.custom');
const colors = props.colors === undefined ? colorsFeature : props.colors;
const disableCustomColors = props.disableCustomColors === undefined ? disableCustomColorsFeature : props.disableCustomColors;
const hasColorsToChoose = !isEmpty(colors) || !disableCustomColors;
return createElement(WrappedComponent, _extends({}, props, {
colors,
disableCustomColors,
hasColorsToChoose
}));
};
}, 'withColorContext');
//# sourceMappingURL=with-color-context.js.map