import _extends from '@babel/runtime/helpers/extends';
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
import { DefinitionTooltip } from '@carbon/react';
import * as React from 'react';
import PropTypes from 'prop-types';

var _excluded = ["direction", "align", "tooltipText", "openOnHover", "children"];
var TooltipDefinition = function TooltipDefinition(_ref) {
  var _ref$direction = _ref.direction,
    direction = _ref$direction === void 0 ? 'bottom' : _ref$direction,
    _ref$align = _ref.align,
    align = _ref$align === void 0 ? 'start' : _ref$align,
    _ref$tooltipText = _ref.tooltipText,
    tooltipText = _ref$tooltipText === void 0 ? '' : _ref$tooltipText,
    _ref$openOnHover = _ref.openOnHover,
    openOnHover = _ref$openOnHover === void 0 ? true : _ref$openOnHover,
    children = _ref.children,
    other = _objectWithoutProperties(_ref, _excluded);
  var newAlign;
  // This function is to pass the old direction, align property to the new align property since The align and direction props have been merged into the align prop
  if (direction === 'bottom' && align === 'center') {
    newAlign = 'bottom';
  } else if (direction === 'bottom' && align === 'end') {
    newAlign = 'bottom-end';
  } else if (direction === 'top' && align === 'start') {
    newAlign = 'top-start';
  } else if (direction === 'top' && align === 'center') {
    newAlign = 'top';
  } else if (direction === 'top' && align === 'end') {
    newAlign = 'top-end';
  } else if (direction === 'right' && align === 'start') {
    newAlign = 'right-start';
  } else if (direction === 'right' && align === 'center') {
    newAlign = 'right';
  } else if (direction === 'right' && align === 'end') {
    newAlign = 'right-end';
  } else if (direction === 'left' && align === 'start') {
    newAlign = 'left-start';
  } else if (direction === 'left' && align === 'center') {
    newAlign = 'left';
  } else if (direction === 'left' && align === 'end') {
    newAlign = 'left-end';
  } else {
    newAlign = 'bottom-start';
  }
  return /*#__PURE__*/React.createElement(DefinitionTooltip, _extends({}, other, {
    // The tooltipText prop has been renamed to definition
    openOnHover: openOnHover,
    definition: tooltipText,
    align: newAlign
  }), children);
};
TooltipDefinition.propTypes = {
  direction: PropTypes.string,
  align: PropTypes.string,
  tooltipText: PropTypes.string,
  children: PropTypes.node.isRequired,
  openOnHover: PropTypes.bool
};
TooltipDefinition.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "TooltipDefinition",
  "props": {
    "direction": {
      "defaultValue": {
        "value": "'bottom'",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "align": {
      "defaultValue": {
        "value": "'start'",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "tooltipText": {
      "defaultValue": {
        "value": "''",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "openOnHover": {
      "defaultValue": {
        "value": "true",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "children": {
      "description": "",
      "type": {
        "name": "node"
      },
      "required": true
    }
  }
};
var TooltipDefinition$1 = TooltipDefinition;

export { TooltipDefinition$1 as default };
