"use strict";

exports.__esModule = true;
exports.default = void 0;
var _uniqueId2 = _interopRequireDefault(require("lodash/fp/uniqueId"));
var _react = _interopRequireWildcard(require("react"));
var _title = _interopRequireDefault(require("../title"));
var _style = _interopRequireDefault(require("./style.css"));
var _types = require("./types");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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); }
const RadioWithTitle = props => {
  const {
    title,
    name,
    checked,
    onChange,
    'data-name': dataName,
    'aria-label': ariaLabel
  } = props;
  const idRadio = (0, _uniqueId2.default)('input-radio-');
  const handleChange = (0, _react.useCallback)(e => onChange(e.target.checked), [onChange]);
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.container
  }, /*#__PURE__*/_react.default.createElement("label", {
    htmlFor: idRadio
  }, /*#__PURE__*/_react.default.createElement("input", {
    type: "radio",
    id: idRadio,
    name: name,
    onChange: handleChange,
    checked: checked,
    className: _style.default.radio,
    "data-name": dataName,
    "aria-label": ariaLabel
  }), /*#__PURE__*/_react.default.createElement("span", {
    className: _style.default.title
  }, /*#__PURE__*/_react.default.createElement(_title.default, _extends({}, title, {
    titleSize: 'small',
    subtitleSize: 'extra-small'
  })))));
};
RadioWithTitle.propTypes = process.env.NODE_ENV !== "production" ? _types.propTypes : {};
var _default = exports.default = RadioWithTitle;
//# sourceMappingURL=index.js.map