function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import React from 'react';
import propTypes from 'prop-types';
import useThemeByComponent from '@zohodesk/theme/es/useThemeByComponent';
export default function SkeletonThemeWrapper(props) {
  let Component = props.component;
  let componentName;

  if (!Component) {
    return null;
  } else if (typeof Component === 'object' && Component !== null) {
    componentName = Component.render.name.replace('Skeleton', '');
  } else {
    componentName = Component.name.replace('Skeleton', '');
  }

  const componentThemeProps = useThemeByComponent(componentName) || {}; // // {shape}                  {shape}
  // // Component.defaultProps - componentThemeProps
  // console.log("componentThemeProps", componentThemeProps);

  return /*#__PURE__*/React.createElement(Component, _extends({
    ref: props.basicProps.getRef
  }, componentThemeProps, props.basicProps, props.renderProps));
}
SkeletonThemeWrapper.propTypes = {
  component: propTypes.any,
  basicProps: propTypes.object,
  renderProps: propTypes.object
};