import { jsx as ___EmotionJSX } from "@emotion/core";

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

import React from 'react';
import PropTypes from 'prop-types';
import { css } from '@emotion/core';
import CheckmarkIcon from '../../svgs/icons/checkmark-icon.svg';
import { COLORS } from '../../constants';
import { OuterContainer, Selector, SelectorContainer, TextContainer, SelectorIcon } from './style';
var propTypes = {
  checked: PropTypes.bool.isRequired,
  onClick: PropTypes.func,
  children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
  type: PropTypes.oneOf(['primary', 'secondary']),
  selector: PropTypes.oneOf(['radio', 'checkbox']),
  icon: PropTypes.node,
  size: PropTypes.oneOf(['large', 'small'])
};
var defaultProps = {
  onClick: function onClick() {},
  type: 'primary',
  selector: 'radio'
};

var SelectorButton = function SelectorButton(_ref) {
  var checked = _ref.checked,
      onClick = _ref.onClick,
      children = _ref.children,
      type = _ref.type,
      selector = _ref.selector,
      icon = _ref.icon,
      size = _ref.size,
      rest = _objectWithoutProperties(_ref, ["checked", "onClick", "children", "type", "selector", "icon", "size"]);

  return ___EmotionJSX(OuterContainer, _extends({
    onClick: onClick,
    onKeyPress: onClick,
    tabIndex: "0",
    selector: selector
  }, rest), ___EmotionJSX(SelectorContainer, null, ___EmotionJSX(SelectorIcon, null, checked ? ___EmotionJSX(CheckmarkIcon, {
    css:
    /*#__PURE__*/
    css("color:", COLORS.white, ";label:SelectorButton;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zaGFyZWQtY29tcG9uZW50cy9zZWxlY3RvckJ1dHRvbi9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUF1RG9CIiwiZmlsZSI6Ii4uLy4uLy4uL3NyYy9zaGFyZWQtY29tcG9uZW50cy9zZWxlY3RvckJ1dHRvbi9pbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCBmcm9tICdyZWFjdCc7XG5pbXBvcnQgUHJvcFR5cGVzIGZyb20gJ3Byb3AtdHlwZXMnO1xuaW1wb3J0IHtjc3N9IGZyb20gJ0BlbW90aW9uL2NvcmUnO1xuXG5pbXBvcnQgQ2hlY2ttYXJrSWNvbiBmcm9tICcuLi8uLi9zdmdzL2ljb25zL2NoZWNrbWFyay1pY29uLnN2Zyc7XG5pbXBvcnQge0NPTE9SU30gZnJvbSAnLi4vLi4vY29uc3RhbnRzJztcbmltcG9ydCB7XG4gIE91dGVyQ29udGFpbmVyLFxuICBTZWxlY3RvcixcbiAgU2VsZWN0b3JDb250YWluZXIsXG4gIFRleHRDb250YWluZXIsXG4gIFNlbGVjdG9ySWNvbixcbn0gZnJvbSAnLi9zdHlsZSc7XG5cbmNvbnN0IHByb3BUeXBlcyA9IHtcbiAgY2hlY2tlZDogUHJvcFR5cGVzLmJvb2wuaXNSZXF1aXJlZCxcbiAgb25DbGljazogUHJvcFR5cGVzLmZ1bmMsXG4gIGNoaWxkcmVuOiBQcm9wVHlwZXMub25lT2ZUeXBlKFt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biAgICAgICAgICAvPiA6XG4gICAgICAgICAgc2l6ZSA9PT0gJ2xhcmdlJyAmJiBpY29uXG4gICAgICAgIH1cbiAgICAgIDwvU2VsZWN0b3JJY29uPlxuICAgICAgPFNlbGVjdG9yIHR5cGU9e3R5cGV9IGNoZWNrZWQ9e2NoZWNrZWR9IHNlbGVjdG9yPXtzZWxlY3Rvcn0gc2l6ZT17c2l6ZX0vPlxuICAgIDwvU2VsZWN0b3JDb250YWluZXI+XG5cbiAgICB7Y2hpbGRyZW4gJiYgKFxuICAgICAgPFRleHRDb250YWluZXI+e2NoaWxkcmVufTwvVGV4dENvbnRhaW5lcj5cbiAgICApfVxuICA8L091dGVyQ29udGFpbmVyPlxuKTtcblxuU2VsZWN0b3JCdXR0b24ucHJvcFR5cGVzID0gcHJvcFR5cGVzO1xuU2VsZWN0b3JCdXR0b24uZGVmYXVsdFByb3BzID0gZGVmYXVsdFByb3BzO1xuXG5leHBvcnQgZGVmYXVsdCBTZWxlY3RvckJ1dHRvbjtcblxuIl19 */")),
    width: 16,
    height: 16
  }) : size === 'large' && icon), ___EmotionJSX(Selector, {
    type: type,
    checked: checked,
    selector: selector,
    size: size
  })), children && ___EmotionJSX(TextContainer, null, children));
};

SelectorButton.propTypes = propTypes;
SelectorButton.defaultProps = defaultProps;
export default SelectorButton;