'shift+left': function shiftLeft() {
return _this2.saturate(-0.1);
return _this2.saturate(-1);
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
return Object(external_wp_element_["createElement"])(keyboard_shortcuts, {
}, Object(external_wp_element_["createElement"])("div", {
background: "hsl(".concat(hsl.h, ",100%, 50%)")
className: "components-color-picker__saturation-color",
onMouseDown: this.handleMouseDown,
onTouchMove: this.handleChange,
onTouchStart: this.handleChange,
}, Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__saturation-white"
}), Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__saturation-black"
}), Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
"aria-label": Object(external_wp_i18n_["__"])('Choose a shade'),
"aria-describedby": "color-picker-saturation-".concat(instanceId),
className: "components-color-picker__saturation-pointer",
onKeyDown: this.preventKeyEvents
}), Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
id: "color-picker-saturation-".concat(instanceId)
}, Object(external_wp_i18n_["__"])('Use your arrow keys to change the base color. Move up to lighten the color, down to darken, left to decrease saturation, and right to increase saturation.'))));
/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */
}(external_wp_element_["Component"]);
/* harmony default export */ var saturation = (Object(external_wp_compose_["compose"])(external_wp_compose_["pure"], external_wp_compose_["withInstanceId"])(saturation_Saturation));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/index.js
function color_picker_createSuper(Derived) { var hasNativeReflectConstruct = color_picker_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; }
function color_picker_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function color_picker_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function color_picker_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { color_picker_ownKeys(Object(source), true).forEach(function (key) { Object(esm_defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { color_picker_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
* Parts of this source were derived and modified from react-color,
* released under the MIT license.
* https://github.com/casesandberg/react-color/
* Copyright (c) 2015 Case Sandberg
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
var toLowerCase = function toLowerCase(value) {
return String(value).toLowerCase();
var color_picker_isValueEmpty = function isValueEmpty(data) {
if (data.source === 'hex' && !data.hex) {
} else if (data.source === 'hsl' && (!data.h || !data.s || !data.l)) {
} else if (data.source === 'rgb' && (!data.r || !data.g || !data.b) && (!data.h || !data.s || !data.v || !data.a) && (!data.h || !data.s || !data.l || !data.a)) {
var color_picker_isValidColor = function isValidColor(colors) {
return colors.hex ? isValidHex(colors.hex) : simpleCheckForValidColor(colors);
* Function that creates the new color object
* from old data and the new value.
* @param {Object} oldColors The old color object.
* @param {string} oldColors.hex
* @param {Object} oldColors.rgb
* @param {number} oldColors.rgb.r
* @param {number} oldColors.rgb.g
* @param {number} oldColors.rgb.b
* @param {number} oldColors.rgb.a
* @param {Object} oldColors.hsl
* @param {number} oldColors.hsl.h
* @param {number} oldColors.hsl.s
* @param {number} oldColors.hsl.l
* @param {number} oldColors.hsl.a
* @param {string} oldColors.draftHex Same format as oldColors.hex
* @param {Object} oldColors.draftRgb Same format as oldColors.rgb
* @param {Object} oldColors.draftHsl Same format as oldColors.hsl
* @param {Object} data Data containing the new value to update.
* @param {Object} data.source One of `hex`, `rgb`, `hsl`.
* @param {string|number} data.value Value to update.
* @param {string} data.valueKey Depends on `data.source` values:
* - when source = `rgb`, valuKey can be `r`, `g`, `b`, or `a`.
* - when source = `hsl`, valuKey can be `h`, `s`, `l`, or `a`.
* @return {Object} A new color object for a specific source. For example:
* { source: 'rgb', r: 1, g: 2, b:3, a:0 }
var color_picker_dataToColors = function dataToColors(oldColors, _ref) {
var source = _ref.source,
valueKey = _ref.valueKey,
return Object(esm_defineProperty["a" /* default */])({
return color_picker_objectSpread({
}, color_picker_objectSpread(color_picker_objectSpread({}, oldColors[source]), Object(esm_defineProperty["a" /* default */])({}, valueKey, value)));
var color_picker_ColorPicker = /*#__PURE__*/function (_Component) {
Object(inherits["a" /* default */])(ColorPicker, _Component);
var _super = color_picker_createSuper(ColorPicker);
function ColorPicker(_ref3) {
var _ref3$color = _ref3.color,
color = _ref3$color === void 0 ? '0071a1' : _ref3$color;
Object(classCallCheck["a" /* default */])(this, ColorPicker);
_this = _super.apply(this, arguments);
var colors = colorToState(color);
_this.state = color_picker_objectSpread(color_picker_objectSpread({}, colors), {}, {
draftHex: toLowerCase(colors.hex),
_this.commitValues = _this.commitValues.bind(Object(assertThisInitialized["a" /* default */])(_this));
_this.setDraftValues = _this.setDraftValues.bind(Object(assertThisInitialized["a" /* default */])(_this));
_this.resetDraftValues = _this.resetDraftValues.bind(Object(assertThisInitialized["a" /* default */])(_this));
_this.handleInputChange = _this.handleInputChange.bind(Object(assertThisInitialized["a" /* default */])(_this));
Object(createClass["a" /* default */])(ColorPicker, [{
value: function commitValues(data) {
var _this$props = this.props,
oldHue = _this$props.oldHue,
_this$props$onChangeC = _this$props.onChangeComplete,
onChangeComplete = _this$props$onChangeC === void 0 ? external_lodash_["noop"] : _this$props$onChangeC;
if (color_picker_isValidColor(data)) {
var colors = colorToState(data, data.h || oldHue);
this.setState(color_picker_objectSpread(color_picker_objectSpread({}, colors), {}, {
draftHex: toLowerCase(colors.hex),
}), Object(external_lodash_["debounce"])(Object(external_lodash_["partial"])(onChangeComplete, colors), 100));
value: function resetDraftValues() {
draftHex: this.state.hex,
draftHsl: this.state.hsl,
value: function setDraftValues(data) {
draftHex: toLowerCase(data.hex)
key: "handleInputChange",
value: function handleInputChange(data) {
var colors = color_picker_dataToColors(this.state, data);
if (!color_picker_isValueEmpty(colors)) {
this.commitValues(colors);
this.setDraftValues(color_picker_dataToColors(this.state, data));
value: function render() {
var _this$props2 = this.props,
className = _this$props2.className,
disableAlpha = _this$props2.disableAlpha;
var _this$state = this.state,
color = _this$state.color,
draftHex = _this$state.draftHex,
draftHsl = _this$state.draftHsl,
draftRgb = _this$state.draftRgb;
var classes = classnames_default()(className, {
'components-color-picker': true,
'is-alpha-disabled': disableAlpha,
'is-alpha-enabled': !disableAlpha
return Object(external_wp_element_["createElement"])("div", {
}, Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__saturation"
}, Object(external_wp_element_["createElement"])(saturation, {
onChange: this.commitValues
})), Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__body"
}, Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__controls"
}, Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__swatch"
}, Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__active",
backgroundColor: color && color.toRgbString()
})), Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__toggles"
}, Object(external_wp_element_["createElement"])(hue, {
onChange: this.commitValues
}), disableAlpha ? null : Object(external_wp_element_["createElement"])(color_picker_alpha, {
onChange: this.commitValues
}))), Object(external_wp_element_["createElement"])(inputs, {
onChange: this.handleInputChange,
disableAlpha: disableAlpha
}(external_wp_element_["Component"]);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-edit/index.js
function DropdownOpenOnMount(_ref) {
var shouldOpen = _ref.shouldOpen,
onToggle = _ref.onToggle;
Object(external_wp_element_["useEffect"])(function () {
if (shouldOpen && !isOpen) {
function ColorOption(_ref2) {
_onChange = _ref2.onChange,
onRemove = _ref2.onRemove,
onConfirm = _ref2.onConfirm,
_ref2$confirmLabel = _ref2.confirmLabel,
confirmLabel = _ref2$confirmLabel === void 0 ? Object(external_wp_i18n_["__"])('OK') : _ref2$confirmLabel,
_ref2$isEditingNameOn = _ref2.isEditingNameOnMount,
isEditingNameOnMount = _ref2$isEditingNameOn === void 0 ? false : _ref2$isEditingNameOn,
_ref2$isEditingColorO = _ref2.isEditingColorOnMount,
isEditingColorOnMount = _ref2$isEditingColorO === void 0 ? false : _ref2$isEditingColorO,
onCancel = _ref2.onCancel,
_ref2$immutableColorS = _ref2.immutableColorSlugs,
immutableColorSlugs = _ref2$immutableColorS === void 0 ? [] : _ref2$immutableColorS;
var _useState = Object(external_wp_element_["useState"])(false),
_useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
setIsHover = _useState2[1];
var _useState3 = Object(external_wp_element_["useState"])(false),
_useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2),
isFocused = _useState4[0],
setIsFocused = _useState4[1];
var _useState5 = Object(external_wp_element_["useState"])(isEditingNameOnMount),
_useState6 = Object(slicedToArray["a" /* default */])(_useState5, 2),
isEditingName = _useState6[0],
setIsEditingName = _useState6[1];
var _useState7 = Object(external_wp_element_["useState"])(false),
_useState8 = Object(slicedToArray["a" /* default */])(_useState7, 2),
isShowingAdvancedPanel = _useState8[0],
setIsShowingAdvancedPanel = _useState8[1];
var isShowingControls = (isHover || isFocused || isEditingName || isShowingAdvancedPanel) && !immutableColorSlugs.includes(slug);
return Object(external_wp_element_["createElement"])("div", {
className: classnames_default()('components-color-edit__color-option', {
'is-hover': isHover && !isEditingName && !isShowingAdvancedPanel
onMouseEnter: function onMouseEnter() {
onMouseLeave: function onMouseLeave() {
return setIsHover(false);
onFocus: function onFocus() {
return setIsFocused(true);
onBlur: function onBlur() {
return setIsFocused(false);
"aria-label": name ? // translators: %s: The name of the color e.g: "vivid red".
Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Color: %s'), name) : // translators: %s: color hex code e.g: "#f00".
Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Color code: %s'), color)
}, Object(external_wp_element_["createElement"])("div", {
className: "components-color-edit__color-option-main-area"
}, Object(external_wp_element_["createElement"])(Dropdown, {
renderToggle: function renderToggle(_ref3) {
var isOpen = _ref3.isOpen,
onToggle = _ref3.onToggle;
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(DropdownOpenOnMount, {
shouldOpen: isEditingColorOnMount,
}), Object(external_wp_element_["createElement"])(CircularOptionPicker.Option, {
"aria-label": Object(external_wp_i18n_["__"])('Edit color value')
renderContent: function renderContent() {
return Object(external_wp_element_["createElement"])(color_picker_ColorPicker, {
onChangeComplete: function onChangeComplete(newColor) {
}), !isEditingName && Object(external_wp_element_["createElement"])("div", {
className: "components-color-edit__color-option-color-name"
}, name), isEditingName && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(text_control, {
className: "components-color-edit__color-option-color-name-input",
hideLabelFromVision: true,
onChange: function onChange(newColorName) {
slug: Object(external_lodash_["kebabCase"])(newColorName),
label: Object(external_wp_i18n_["__"])('Color name'),
placeholder: Object(external_wp_i18n_["__"])('Name'),
}), Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
onClick: function onClick() {
}, confirmLabel)), !isEditingName && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: classnames_default()({
'components-color-edit__hidden-control': !isShowingControls
icon: edit["a" /* default */],
label: Object(external_wp_i18n_["__"])('Edit color name'),
onClick: function onClick() {
return setIsEditingName(true);
}), Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: classnames_default()({