import { extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
import React__default, { forwardRef } from 'react';
import { Hint, HintTargetWrapper, HintIconWrapper } from '../../TextArea.styles.js';
import { IconInfoCircleOutline } from '../../../_Icon/Icons/IconInfoCircleOutline.js';
import { tokens } from '../../TextArea.tokens.js';
import { safeUseId } from '../../../../utils/react.js';

var HintComponent = /*#__PURE__*/forwardRef(function (_ref, ref) {
  var hintText = _ref.hintText,
    isHintVisible = _ref.isHintVisible,
    hintTrigger = _ref.hintTrigger,
    hintTargetIcon = _ref.hintTargetIcon,
    hintPlacement = _ref.hintPlacement,
    hintHasArrow = _ref.hintHasArrow,
    hintOffset = _ref.hintOffset,
    hintWidth = _ref.hintWidth,
    hintContentLeft = _ref.hintContentLeft,
    isInnerLabel = _ref.isInnerLabel,
    size = _ref.size,
    handleHintShow = _ref.handleHintShow,
    handleHintHide = _ref.handleHintHide,
    handleHintClick = _ref.handleHintClick;
  var hintId = safeUseId();
  var getInfoIconSize = function getInfoIconSize() {
    if (!isInnerLabel || size === 'xs') {
      return 'xs';
    }
    return 's';
  };
  return /*#__PURE__*/React__default.createElement(Hint, {
    ref: ref,
    text: String(hintText),
    opened: isHintVisible,
    target: /*#__PURE__*/React__default.createElement(HintTargetWrapper, null, /*#__PURE__*/React__default.createElement(HintIconWrapper, _extends({
      id: hintId
    }, hintTrigger === 'hover' ? {
      onMouseEnter: handleHintShow,
      onMouseLeave: handleHintHide
    } : {
      onClick: handleHintClick
    }), hintTargetIcon || /*#__PURE__*/React__default.createElement(IconInfoCircleOutline, {
      size: getInfoIconSize(),
      color: "inherit",
      sizeCustomProperty: tokens.hintCustomIconTargetSize
    }))),
    placement: hintPlacement,
    hasArrow: hintHasArrow,
    offset: hintOffset,
    minWidth: hintWidth,
    maxWidth: hintWidth,
    contentLeft: hintContentLeft,
    frame: hintId
  });
});

export { HintComponent };
