import _noop from "lodash/fp/noop";
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import React, { useState, useCallback } from 'react';
import PropTypes from 'prop-types';
const Checkbox = props => {
  const {
    checked,
    onChange = _noop,
    type = 'checkbox',
    ...rest
  } = props;
  const [_checked, setChecked] = useState(checked);
  const handleChange = useCallback(e => {
    onChange(e.target.checked);
    setChecked(!_checked);
  }, [_checked, onChange]);
  return /*#__PURE__*/React.createElement("input", _extends({}, rest, {
    checked: _checked,
    type: type,
    onChange: handleChange
  }));
};
Checkbox.propTypes = process.env.NODE_ENV !== "production" ? {
  checked: PropTypes.bool,
  onChange: PropTypes.func,
  title: PropTypes.string,
  type: PropTypes.string,
  required: PropTypes.bool,
  disabled: PropTypes.bool,
  'data-name': PropTypes.string,
  'aria-label': PropTypes.string
} : {};
export default Checkbox;
//# sourceMappingURL=index.js.map