var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import React from 'react';
import { addSubcomponents } from '../../utils/addSubcomponents';
import { OverlayTrigger } from '../OverlayTrigger';
import { StyledContainer, StyledTooltip } from './Tooltip.styles';
var Content = React.forwardRef(function Content(_a, ref) {
    var children = _a.children, _b = _a.placement, placement = _b === void 0 ? 'top' : _b, props = __rest(_a, ["children", "placement"]);
    return (React.createElement(StyledContainer, { ref: ref },
        React.createElement(StyledTooltip, __assign({}, props, { "$placement": placement }), children)));
});
/**

 We use tooltips to display additional descriptive information about an element
 or item to the user. For example, we could use them to explain a specific term
 or phrase, to denote the specific format required (e.g. mm/dd/yyy), or to
 clarify certain information (e.g. why a button is disabled).

 They can be displayed either by hovering over an element in the product or by
 hovering over an icon next to an element.

 @since 10.19.0

 @see [Storybook](https://procore.github.io/core/latest/?path=/story/tooltip--always-on-tooltip)

 @see [Design Guidelines](https://design.procore.com/tooltip)

 */
var Tooltip_ = React.forwardRef(function Tooltip(_a, ref) {
    var children = _a.children, _b = _a.initialIsVisible, initialIsVisible = _b === void 0 ? false : _b, overlay = _a.overlay, _c = _a.placement, placement = _c === void 0 ? 'top' : _c, _d = _a.trigger, trigger = _d === void 0 ? 'hover' : _d, props = __rest(_a, ["children", "initialIsVisible", "overlay", "placement", "trigger"]);
    var overlayNode = React.isValidElement(overlay) ? (React.cloneElement(overlay, { placement: placement })) : (React.createElement(Content, { placement: placement }, overlay));
    return (React.createElement(OverlayTrigger, __assign({}, __assign(__assign({}, props), { initialIsVisible: initialIsVisible, overlay: overlayNode, placement: placement, ref: ref, restoreFocusOnHide: false, trigger: trigger, shrinkOverlay: true })), children));
});
Tooltip_.displayName = 'Tooltip';
Content.displayName = 'Tooltip.Content';
export var Tooltip = addSubcomponents({
    Content: Content,
}, Tooltip_);
export default Tooltip;
//# sourceMappingURL=Tooltip.js.map