import _omit from "ramda/src/omit";
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
import React from 'react';
import styled, { css } from 'styled-components';
import { isFunction } from '../../../../common/utils';
var CleanDiv = React.forwardRef(function (props, ref) {
  return React.createElement("div", _extends({
    ref: ref
  }, _omit(['barColor', 'noPadding'])(props)));
});
var getColor = function getColor(props) {
  var barColor = props.barColor,
    theme = props.theme;
  if (isFunction(barColor)) {
    return barColor(theme);
  }
  return 'transparent';
};
var barStyles = css(["border-left:2px solid ", ";"], function (p) {
  return getColor(p);
});
var StyledDiv = styled(CleanDiv).withConfig({
  displayName: "Pill__StyledDiv",
  componentId: "sc-13oal3u-0"
})(["display:inline-block;", ";box-sizing:border-box;background:", ";box-shadow:0 1px 4px 0 rgb(0 0 0 / 21%);", ""], function (p) {
  return p.noPadding ? "" : "padding: 0 ".concat(p.theme.spacing.unit(1), "px");
}, function (_ref) {
  var theme = _ref.theme;
  return theme.color.card;
}, function (p) {
  return p.barColor ? barStyles : "";
});
export var Pill = function Pill(_ref2) {
  var barColor = _ref2.barColor,
    className = _ref2.className,
    children = _ref2.children,
    noPadding = _ref2.noPadding;
  return React.createElement(StyledDiv, {
    className: className,
    barColor: barColor,
    noPadding: noPadding
  }, children);
};
Pill.displayName = 'Pill';