"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _css2 = require("@emotion/css");

var _css3 = _interopRequireDefault(_css2);

var _core = require("@emotion/core");

var _propTypes = require("prop-types");

var _propTypes2 = _interopRequireDefault(_propTypes);

var _presets = require("../../utils/presets");

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

function 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 _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var baseStyles = {
  color: _presets.colors.grey[70],
  display: "block",
  fontSize: _presets.fontSizes["2xs"],
  margin: "0 0 ".concat(_presets.spaces.xs, " ").concat(_presets.spaces["2xs"])
};

var Label = function Label(_ref) {
  var children = _ref.children,
      id = _ref.id,
      _ref$variant = _ref.variant,
      variant = _ref$variant === void 0 ? "DEFAULT" : _ref$variant;
  var labelStyles = {
    BIG: {
      fontSize: _presets.fontSizes.s
    },
    SMALL: {
      color: _presets.colors.grey[50],
      display: "block",
      fontSize: _presets.fontSizes.xs,
      svg: {
        color: _presets.colors.grey[40],
        marginRight: _presets.spaces["2xs"],
        verticalAlign: "text-top"
      }
    }
  };
  return (0, _core.jsx)("label", {
    htmlFor: id,
    css:
    /*#__PURE__*/
    (0, _css3["default"])(_objectSpread({}, baseStyles, {}, labelStyles[variant]), "label:Label;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0xhYmVsL0xhYmVsLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWdDTSIsImZpbGUiOiIuLi8uLi8uLi9zcmMvY29tcG9uZW50cy9MYWJlbC9MYWJlbC5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsganN4IH0gZnJvbSBcIkBlbW90aW9uL2NvcmVcIlxuaW1wb3J0IFByb3BUeXBlcyBmcm9tIFwicHJvcC10eXBlc1wiXG5cbmltcG9ydCB7IHNwYWNlcywgY29sb3JzLCBmb250U2l6ZXMgfSBmcm9tIFwiLi4vLi4vdXRpbHMvcHJlc2V0c1wiXG5cbmNvbnN0IGJhc2VTdHlsZXMgPSB7XG4gIGNvbG9yOiBjb2xvcnMuZ3JleVs3MF0sXG4gIGRpc3BsYXk6IGBibG9ja2AsXG4gIGZvbnRTaXplOiBmb250U2l6ZXNbYDJ4c2BdLFxuICBtYXJnaW46IGAwIDAgJHtzcGFjZXMueHN9ICR7c3BhY2VzW2AyeHNgXX1gLFxufVxuXG5jb25zdCBMYWJlbCA9ICh7IGNoaWxkcmVuLCBpZCwgdmFyaWFudCA9IGBERUZBVUxUYCB9KSA9PiB7XG4gIGNvbnN0IGxhYmVsU3R5bGVzID0ge1xuICAgIEJJRzoge1xuICAgICAgZm9udFNpemU6IGZvbnRTaXplcy5zLFxuICAgIH0sXG4gICAgU01BTEw6IHtcbiAgICAgIGNvbG9yOiBjb2xvcnMuZ3JleVs1MF0sXG4gICAgICBkaXNwbGF5OiBgYmxvY2tgLFxuICAgICAgZm9udFNpemU6IGZvbnRTaXplcy54cyxcbiAgICAgIHN2Zzoge1xuICAgICAgICBjb2xvcjogY29sb3JzLmdyZXlbNDBdLFxuICAgICAgICBtYXJnaW5SaWdodDogc3BhY2VzW2AyeHNgXSxcbiAgICAgICAgdmVydGljYWxBbGlnbjogYHRleHQtdG9wYCxcbiAgICAgIH0sXG4gICAgfSxcbiAgfVxuICByZXR1cm4gKFxuICAgIDxsYWJlbFxuICAgICAgaHRtbEZvcj17aWR9XG4gICAgICBjc3M9e3tcbiAgICAgICAgLi4uYmFzZVN0eWxlcyxcbiAgICAgICAgLi4ubGFiZWxTdHlsZXNbdmFyaWFudF0sXG4gICAgICB9fVxuICAgID5cbiAgICAgIHtjaGlsZHJlbn1cbiAgICA8L2xhYmVsPlxuICApXG59XG5cbkxhYmVsLnByb3BUeXBlcyA9IHtcbiAgaWQ6IFByb3BUeXBlcy5zdHJpbmcsXG4gIHZhcmlhbnQ6IFByb3BUeXBlcy5vbmVPZihbYERFRkFVTFRgLCBgU01BTExgLCBgQklHYF0pLFxuICBjaGlsZHJlbjogUHJvcFR5cGVzLm5vZGUsXG59XG5cbmV4cG9ydCBkZWZhdWx0IExhYmVsXG4iXX0= */"))
  }, children);
};

Label.propTypes = {
  id: _propTypes2["default"].string,
  variant: _propTypes2["default"].oneOf(["DEFAULT", "SMALL", "BIG"]),
  children: _propTypes2["default"].node
};
exports["default"] = Label;