"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _constants = require("./constants");
var _ColorPickerHistorySt = require("./ColorPickerHistory.st.css.js");
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/ColorPicker/ColorPickerHistory.jsx",
  _this = void 0;
var ColorPickerHistory = function ColorPickerHistory(_ref) {
  var show = _ref.show,
    current = _ref.current,
    previous = _ref.previous,
    _onClick = _ref.onClick;
  var handleKeyDown = function handleKeyDown(e) {
    if (e.key === 'Enter' || e.key === ' ') {
      e.preventDefault();
      _onClick(previous);
    }
  };
  if (show) {
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: _ColorPickerHistorySt.classes.root,
      "data-hook": _constants.DataHooks.history,
      __self: _this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 15,
        columnNumber: 7
      }
    }, /*#__PURE__*/_react["default"].createElement("div", {
      "data-hook": _constants.DataHooks.historyPrevious,
      style: {
        background: previous.hex()
      },
      onClick: function onClick() {
        return _onClick(previous);
      },
      onKeyDown: handleKeyDown,
      tabIndex: 0,
      role: "button",
      "aria-label": "Previous color: ".concat(previous.hex()),
      __self: _this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 16,
        columnNumber: 9
      }
    }), /*#__PURE__*/_react["default"].createElement("div", {
      "data-hook": _constants.DataHooks.historyCurrent,
      style: {
        background: current.hex()
      },
      role: "img",
      "aria-label": "Current color: ".concat(current.hex()),
      __self: _this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 25,
        columnNumber: 9
      }
    }));
  }
  return null;
};
var _default = exports["default"] = ColorPickerHistory;