function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function _object_spread(target) {
    for(var i = 1; i < arguments.length; i++){
        var source = arguments[i] != null ? arguments[i] : {};
        var ownKeys = Object.keys(source);
        if (typeof Object.getOwnPropertySymbols === "function") {
            ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
                return Object.getOwnPropertyDescriptor(source, sym).enumerable;
            }));
        }
        ownKeys.forEach(function(key) {
            _define_property(target, key, source[key]);
        });
    }
    return target;
}
import React, { forwardRef } from "react";
import { safeUseId } from "../../../../utils";
import { Hint, HintTargetWrapper, HintIconWrapper } from "../../InformationWrapper.styles";
import { IconInfoCircleOutline } from "../../../_Icon";
import { tokens } from "../../InformationWrapper.tokens";
export var HintComponent = /*#__PURE__*/ forwardRef(function(param, ref) {
    var hintText = param.hintText, isHintVisible = param.isHintVisible, hintTrigger = param.hintTrigger, hintTargetIcon = param.hintTargetIcon, hintPlacement = param.hintPlacement, hintHasArrow = param.hintHasArrow, hintOffset = param.hintOffset, hintWidth = param.hintWidth, hintContentLeft = param.hintContentLeft, withoutLabel = param.withoutLabel, size = param.size, handleHintShow = param.handleHintShow, handleHintHide = param.handleHintHide, handleHintClick = param.handleHintClick;
    var hintId = safeUseId();
    var getInfoIconSize = function getInfoIconSize() {
        if (!withoutLabel || size === 'xs') {
            return 'xs';
        }
        return 's';
    };
    var hintTriggerHandler = hintTrigger === 'hover' ? {
        onMouseEnter: handleHintShow,
        onMouseLeave: handleHintHide
    } : {
        onClick: handleHintClick
    };
    return /*#__PURE__*/ React.createElement(Hint, {
        ref: ref,
        text: String(hintText),
        opened: isHintVisible,
        target: /*#__PURE__*/ React.createElement(HintTargetWrapper, null, /*#__PURE__*/ React.createElement(HintIconWrapper, _object_spread({
            id: hintId
        }, hintTriggerHandler), hintTargetIcon || /*#__PURE__*/ React.createElement(IconInfoCircleOutline, {
            size: getInfoIconSize(),
            color: "inherit",
            sizeCustomProperty: tokens.hintCustomIconTargetSize
        }))),
        placement: hintPlacement,
        hasArrow: hintHasArrow,
        offset: hintOffset,
        minWidth: hintWidth,
        maxWidth: hintWidth,
        contentLeft: hintContentLeft,
        frame: hintId
    });
});
