import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["children", "className", "id"];
import React from "react";
import PropTypes from "prop-types";
import cx from "classnames";
import getClasses from "./styles";
import { useRadioProps } from "./RadioGroupContext";
var Radio = /*#__PURE__*/React.forwardRef(function (props, inputRef) {
  var _useRadioProps = useRadioProps(props),
      children = _useRadioProps.children,
      className = _useRadioProps.className,
      id = _useRadioProps.id,
      inputProps = _objectWithoutProperties(_useRadioProps, _excluded);

  var classes = getClasses();
  return /*#__PURE__*/React.createElement("label", {
    className: classes.label,
    htmlFor: id
  }, /*#__PURE__*/React.createElement("input", _extends({
    type: "radio",
    ref: inputRef,
    className: cx(classes.input, className),
    id: id
  }, inputProps)), /*#__PURE__*/React.createElement("span", null, children));
});
Radio.propTypes = {
  name: PropTypes.string,
  checked: PropTypes.bool,
  value: PropTypes.string,
  onChange: PropTypes.func,
  disabled: PropTypes.bool,
  defaultChecked: PropTypes.bool,
  className: PropTypes.string
};
Radio.defaultProps = {};

if (process.env.NODE_ENV !== "production") {
  Radio.displayName = "NextRadio";
}

export default Radio;