"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ClearInputButton = exports.StyledCloseButtonContainer = exports.SearchCloseIcon = void 0;

var _react = _interopRequireDefault(require("react"));

var _styledComponents = _interopRequireWildcard(require("styled-components"));

var _behaviors = require("../../../behaviors");

var _branding = require("../../../../mixins/branding");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var _SearchCloseIcon = function _SearchCloseIcon(_ref) {
  var theme = _ref.theme;
  return _react["default"].createElement("svg", {
    xmlns: "http://www.w3.org/2000/svg",
    width: "16",
    height: "16",
    viewBox: "0 0 16 16"
  }, _react["default"].createElement("g", {
    fill: "none",
    fillRule: "evenodd",
    stroke: (0, _branding.getPaletteColor)('greyscale-black')({
      theme: theme
    }),
    strokeLinecap: "round",
    strokeWidth: "2"
  }, _react["default"].createElement("path", {
    d: "M3 13L13 3M3 3l10 10"
  })));
};

var SearchCloseIcon = (0, _styledComponents.withTheme)(_SearchCloseIcon);
exports.SearchCloseIcon = SearchCloseIcon;
SearchCloseIcon.displayName = 'SearchCloseIcon';
var StyledCloseButtonContainer = (0, _styledComponents["default"])(_behaviors.UnstyledButton).withConfig({
  displayName: "StyledCloseButtonContainer",
  componentId: "sc-1yh8zue-0"
})(["&&{height:100%;position:absolute;right:0px;text-align:center;top:0;width:", ";&:focus{box-shadow:none;}}"], function (_ref2) {
  var large = _ref2.large;
  return large ? '55px' : '40px';
});
exports.StyledCloseButtonContainer = StyledCloseButtonContainer;

var ClearInputButton = function ClearInputButton(_ref3) {
  var show = _ref3.show,
      onClick = _ref3.onClick,
      large = _ref3.large;
  return show && _react["default"].createElement(StyledCloseButtonContainer, {
    large: large,
    onClick: onClick
  }, _react["default"].createElement("div", {
    style: {
      position: 'relative',
      right: large ? '5px' : '13px'
    }
  }, _react["default"].createElement(SearchCloseIcon, null)));
};

exports.ClearInputButton = ClearInputButton;
ClearInputButton.displayName = 'ClearInputButton';