import { __makeTemplateObject } from "tslib";
import styled, { css } from "styled-components";
import { LIGHT_THEME } from "../Pallette/themes";
import { ZINDEX } from "../Pallette/ZIndex";
import { getTheme } from "../utils/theme/getTheme";
import P1 from "../typography/P1";
import { defaultThemeTooltip } from "./themes";
export var MARGIN = 15;
export var COMPONENT_NAME = "tooltip";
var getDirectionStyles = function (direction, componentSizeAndPosition, textContentSize) {
    switch (direction) {
        case "top":
            return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n        left: ", "px;\n        top: ", "px;\n      "], ["\n        left: ", "px;\n        top: ", "px;\n      "])), componentSizeAndPosition.left +
                componentSizeAndPosition.width / 2 -
                textContentSize.width / 2, componentSizeAndPosition.top -
                MARGIN -
                textContentSize.height);
        case "bottom":
            return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n        top: ", "px;\n        left: ", "px;\n      "], ["\n        top: ", "px;\n        left: ", "px;\n      "])), componentSizeAndPosition.bottom + MARGIN, componentSizeAndPosition.left +
                componentSizeAndPosition.width / 2 -
                textContentSize.width / 2);
        case "right":
            return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n        top: ", "px;\n        left: ", "px;\n      "], ["\n        top: ", "px;\n        left: ", "px;\n      "])), componentSizeAndPosition.height / 2 -
                textContentSize.height / 2 +
                componentSizeAndPosition.top, componentSizeAndPosition.left +
                MARGIN +
                componentSizeAndPosition.width);
        case "left":
            return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n        left: ", "px;\n        top: ", "px;\n      "], ["\n        left: ", "px;\n        top: ", "px;\n      "])), componentSizeAndPosition.left -
                MARGIN -
                textContentSize.width, componentSizeAndPosition.height / 2 -
                textContentSize.height / 2 +
                componentSizeAndPosition.top);
        case "bottomRight":
            return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n        top: ", "px;\n        left: ", "px;\n      "], ["\n        top: ", "px;\n        left: ", "px;\n      "])), componentSizeAndPosition.bottom + MARGIN, componentSizeAndPosition.right - textContentSize.width);
        case "bottomLeft":
            return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n        top: ", "px;\n        left: ", "px;\n      "], ["\n        top: ", "px;\n        left: ", "px;\n      "])), componentSizeAndPosition.bottom + MARGIN, componentSizeAndPosition.left);
        case "topLeft":
            return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n        top: ", "px;\n        left: ", "px;\n      "], ["\n        top: ", "px;\n        left: ", "px;\n      "])), componentSizeAndPosition.top -
                MARGIN -
                textContentSize.height, componentSizeAndPosition.left);
        case "topRight":
            return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n        top: ", "px;\n        left: ", "px;\n      "], ["\n        top: ", "px;\n        left: ", "px;\n      "])), componentSizeAndPosition.top -
                MARGIN -
                textContentSize.height, componentSizeAndPosition.right - textContentSize.width);
        default:
            return css(templateObject_9 || (templateObject_9 = __makeTemplateObject([""], [""])));
    }
};
export var TooltipStyled = styled.div(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n  display: inline-block;\n  position: relative;\n"], ["\n  display: inline-block;\n  position: relative;\n"])));
export var TrailContentStyled = styled(P1)(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n  margin-left: 8px;\n"], ["\n  margin-left: 8px;\n"])));
export var TooltipContentWrapper = styled.div.attrs(function (props) { return ({
    theme: getTheme({
        theme: props.theme,
        defaultTheme: defaultThemeTooltip,
        componentName: COMPONENT_NAME
    })
}); })(templateObject_22 || (templateObject_22 = __makeTemplateObject(["\n  position: absolute;\n\n  padding: 4px 8px 2px 8px;\n  width: max-content;\n  display: flex;\n  flex-direction: row;\n  border-radius: 8px;\n  z-index: ", ";\n  ::after {\n    ", "\n  }\n  ", ";\n\n  ", ";\n\n  ", ";\n\n  ", " {\n    color: ", ";\n  }\n\n  opacity: 0;\n\n  &.tooltip-content {\n    &-enter {\n      opacity: 0;\n    }\n    &-enter-done {\n      opacity: 1;\n    }\n    &-exit {\n      opacity: 1;\n    }\n    &-exit-active {\n      opacity: 0;\n    }\n  }\n"], ["\n  position: absolute;\n\n  padding: 4px 8px 2px 8px;\n  width: max-content;\n  display: flex;\n  flex-direction: row;\n  border-radius: 8px;\n  z-index: ", ";\n  ::after {\n    ", "\n  }\n  ", ";\n\n  ", ";\n\n  ", ";\n\n  ", " {\n    color: ", ";\n  }\n\n  opacity: 0;\n\n  &.tooltip-content {\n    &-enter {\n      opacity: 0;\n    }\n    &-enter-done {\n      opacity: 1;\n    }\n    &-exit {\n      opacity: 1;\n    }\n    &-exit-active {\n      opacity: 0;\n    }\n  }\n"])), ZINDEX.tooltip, function (_a) {
    var direction = _a.direction, theme = _a.theme;
    switch (direction) {
        case "top":
            return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n            content: \"\";\n            position: absolute;\n            top: 100%;\n            left: 50%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: ", "\n              transparent transparent;\n          "], ["\n            content: \"\";\n            position: absolute;\n            top: 100%;\n            left: 50%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: ", "\n              transparent transparent;\n          "])), theme.components[COMPONENT_NAME].background);
        case "bottom":
            return css(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n            content: \"\";\n            position: absolute;\n            bottom: 100%;\n            left: 50%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: transparent transparent\n              ", ";\n          "], ["\n            content: \"\";\n            position: absolute;\n            bottom: 100%;\n            left: 50%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: transparent transparent\n              ", ";\n          "])), theme.components[COMPONENT_NAME].background);
        case "right":
            return css(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n            content: \"\";\n            position: absolute;\n            bottom: 30%;\n            right: 100%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-color: transparent\n              ", " transparent\n              transparent;\n          "], ["\n            content: \"\";\n            position: absolute;\n            bottom: 30%;\n            right: 100%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-color: transparent\n              ", " transparent\n              transparent;\n          "])), theme.components[COMPONENT_NAME].background);
        case "left":
            return css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n            content: \"\";\n            position: absolute;\n            bottom: 30%;\n            left: 100%;\n            margin-right: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-color: transparent transparent transparent\n              ", ";\n          "], ["\n            content: \"\";\n            position: absolute;\n            bottom: 30%;\n            left: 100%;\n            margin-right: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-color: transparent transparent transparent\n              ", ";\n          "])), theme.components[COMPONENT_NAME].background);
        case "topRight":
            return css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n            content: \"\";\n            position: absolute;\n            top: 100%;\n            right: 10%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: ", "\n              transparent transparent;\n          "], ["\n            content: \"\";\n            position: absolute;\n            top: 100%;\n            right: 10%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: ", "\n              transparent transparent;\n          "])), theme.components[COMPONENT_NAME].background);
        case "bottomRight":
            return css(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n            content: \"\";\n            position: absolute;\n            bottom: 100%;\n            right: 10%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: transparent transparent\n              ", ";\n          "], ["\n            content: \"\";\n            position: absolute;\n            bottom: 100%;\n            right: 10%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: transparent transparent\n              ", ";\n          "])), theme.components[COMPONENT_NAME].background);
        case "topLeft":
            return css(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n            content: \"\";\n            position: absolute;\n            top: 100%;\n            left: 10%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: ", "\n              transparent transparent;\n          "], ["\n            content: \"\";\n            position: absolute;\n            top: 100%;\n            left: 10%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: ", "\n              transparent transparent;\n          "])), theme.components[COMPONENT_NAME].background);
        case "bottomLeft":
            return css(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n            content: \"\";\n            position: absolute;\n            bottom: 100%;\n            left: 10%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: transparent transparent\n              ", ";\n          "], ["\n            content: \"\";\n            position: absolute;\n            bottom: 100%;\n            left: 10%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: transparent transparent\n              ", ";\n          "])), theme.components[COMPONENT_NAME].background);
        default:
            return css(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n            content: \"\";\n            position: absolute;\n            top: 100%;\n            left: 50%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n          "], ["\n            content: \"\";\n            position: absolute;\n            top: 100%;\n            left: 50%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n          "])));
    }
}, function (_a) {
    var theme = _a.theme;
    return css(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n      background: ", ";\n      color: ", ";\n    "], ["\n      background: ", ";\n      color: ", ";\n    "])), theme.components[COMPONENT_NAME].background, theme.components[COMPONENT_NAME].color);
}, function (_a) {
    var isShadow = _a.isShadow, theme = _a.theme;
    return isShadow && theme.shadows.hp.bottom;
}, function (_a) {
    var direction = _a.direction, componentSizeAndPosition = _a.componentSizeAndPosition, textContentSize = _a.textContentSize;
    return getDirectionStyles(direction, componentSizeAndPosition, textContentSize);
}, TrailContentStyled, function (_a) {
    var theme = _a.theme;
    return theme.components[COMPONENT_NAME].colorTrail;
});
TooltipContentWrapper.defaultProps = {
    theme: LIGHT_THEME
};
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22;
