"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _FormControlLabel = _interopRequireDefault(require("@material-ui/core/FormControlLabel"));

var _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));

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

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

var _styles = require("@material-ui/core/styles");

var _classnames = _interopRequireDefault(require("classnames"));

var _grey = _interopRequireDefault(require("@material-ui/core/colors/grey"));

var _renderUi = require("../render-ui");

var Checkbox = function Checkbox(_ref) {
  var _classNames2;

  var mini = _ref.mini,
      checked = _ref.checked,
      onChange = _ref.onChange,
      value = _ref.value,
      label = _ref.label,
      classes = _ref.classes,
      error = _ref.error;
  return /*#__PURE__*/_react["default"].createElement(_FormControlLabel["default"], {
    className: (0, _classnames["default"])(classes.mini),
    classes: {
      label: (0, _classnames["default"])(classes.label, (0, _defineProperty2["default"])({}, classes.miniLabel, mini))
    },
    control: /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
      checked: checked,
      onChange: onChange,
      value: value,
      className: (0, _classnames["default"])(classes.customColor, (_classNames2 = {}, (0, _defineProperty2["default"])(_classNames2, classes.miniCheckbox, mini), (0, _defineProperty2["default"])(_classNames2, classes.error, error), _classNames2))
    }),
    label: label
  });
};

Checkbox.propTypes = {
  mini: _propTypes["default"].bool,
  classes: _propTypes["default"].object.isRequired,
  checked: _propTypes["default"].bool.isRequired,
  onChange: _propTypes["default"].func.isRequired,
  value: _propTypes["default"].string,
  label: _propTypes["default"].string.isRequired
};
Checkbox.defaultProps = {
  value: '',
  mini: false
};

var _default = (0, _styles.withStyles)(function (theme) {
  return {
    label: {
      fontSize: theme.typography.fontSize - 1,
      transform: 'translate(-4%, 2%)',
      color: 'rgba(0,0,0,1.0)'
    },
    miniCheckbox: {
      margin: 0,
      padding: 0,
      width: theme.spacing.unit * 3,
      height: theme.spacing.unit * 3
    },
    miniLabel: {
      marginLeft: theme.spacing.unit,
      color: _grey["default"][700],
      fontSize: theme.typography.fontSize - 3
    },
    mini: {
      margin: 0,
      marginLeft: 0,
      padding: 0
    },
    error: {
      color: theme.palette.error.main
    },
    customColor: {
      color: "".concat(_renderUi.color.tertiary(), " !important")
    }
  };
})(Checkbox);

exports["default"] = _default;
//# sourceMappingURL=checkbox.js.map