"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

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

exports.__esModule = true;
exports.default = void 0;

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

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

var _getDisplayName = _interopRequireDefault(require("../utils/getDisplayName"));

var _useGeneratedId = _interopRequireDefault(require("../hooks/useGeneratedId"));

var withGeneratedId = function withGeneratedId(NextComponent) {
  var WithGeneratedId = (0, _react.forwardRef)(function (props, ref) {
    var generatedId = (0, _useGeneratedId.default)();
    return _react.default.createElement(NextComponent, (0, _extends2.default)({
      generatedId: generatedId,
      ref: ref
    }, props));
  });
  WithGeneratedId.displayName = "withGeneratedId(" + (0, _getDisplayName.default)(NextComponent) + ")";
  return WithGeneratedId;
};

var _default = withGeneratedId;
exports.default = _default;