import _uniqueId from "lodash/fp/uniqueId";
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, { useCallback } from 'react';
import Title from '../title';
import style from './style.css';
import { propTypes } from './types';
const RadioWithTitle = props => {
  const {
    title,
    name,
    checked,
    onChange,
    'data-name': dataName,
    'aria-label': ariaLabel
  } = props;
  const idRadio = _uniqueId('input-radio-');
  const handleChange = useCallback(e => onChange(e.target.checked), [onChange]);
  return /*#__PURE__*/React.createElement("div", {
    className: style.container
  }, /*#__PURE__*/React.createElement("label", {
    htmlFor: idRadio
  }, /*#__PURE__*/React.createElement("input", {
    type: "radio",
    id: idRadio,
    name: name,
    onChange: handleChange,
    checked: checked,
    className: style.radio,
    "data-name": dataName,
    "aria-label": ariaLabel
  }), /*#__PURE__*/React.createElement("span", {
    className: style.title
  }, /*#__PURE__*/React.createElement(Title, _extends({}, title, {
    titleSize: 'small',
    subtitleSize: 'extra-small'
  })))));
};
RadioWithTitle.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
export default RadioWithTitle;
//# sourceMappingURL=index.js.map