import React__default, { forwardRef } from 'react';
import { createPortal } from 'react-dom';
import PropTypes from 'prop-types';
import { settings } from '../../../constants/Settings.js';

var iotPrefix = settings.iotPrefix;
var propTypes = {
  /**
   * Any children to show in the avatar while dragging. Usually the row name and icon or similar.
   */
  children: PropTypes.node.isRequired,
  /** CSS z-index for the avatar. */
  zIndex: PropTypes.number.isRequired
};

/**
 * The drag avatar that shows a preview of what's being dragged. The caller provides the child
 * "image" node (anything) to show, but this draws the bordered tile and around it. This must be
 * absolutely positioned on the page via its ref.
 *
 * @param {object} props
 * @param {ref} ref React ref to connect to the root dom node.
 *
 */
var TableDragAvatar = /*#__PURE__*/forwardRef(function TableDragAvatar(_ref, ref) {
  var zIndex = _ref.zIndex,
    children = _ref.children;
  return /*#__PURE__*/createPortal(/*#__PURE__*/React__default.createElement("div", {
    className: "".concat(iotPrefix, "--table-drag-avatar"),
    ref: ref,
    style: {
      zIndex: zIndex
    }
  }, children), document.body);
});
TableDragAvatar.propTypes = propTypes;
TableDragAvatar.__docgenInfo = {
  "description": "The drag avatar that shows a preview of what's being dragged. The caller provides the child\n\"image\" node (anything) to show, but this draws the bordered tile and around it. This must be\nabsolutely positioned on the page via its ref.\n\n@param {object} props\n@param {ref} ref React ref to connect to the root dom node.",
  "methods": [],
  "displayName": "TableDragAvatar",
  "props": {
    "children": {
      "description": "Any children to show in the avatar while dragging. Usually the row name and icon or similar.",
      "type": {
        "name": "node"
      },
      "required": true
    },
    "zIndex": {
      "description": "CSS z-index for the avatar.",
      "type": {
        "name": "number"
      },
      "required": true
    }
  }
};

export { TableDragAvatar };
