import { __makeTemplateObject } from "tslib";
import styled, { css } from "styled-components";
import { LIGHT_THEME } from "../Pallette/themes";
import { BorderRadius } from "../Pallette/style-utils";
import { ZINDEX } from "../Pallette/ZIndex";
import { getTheme } from "../utils/theme/getTheme";
import { defaultThemePopover } from "./themes";
export var MARGIN = 15;
export var COMPONENT_NAME = "popover";
var getDirectionStyles = function (direction, componentSizeAndPosition, textContentSize, theme) {
    switch (direction) {
        case "top":
            return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n        left: ", "px;\n        top: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 100%;\n          left: 50%;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(180deg);\n        }\n      "], ["\n        left: ", "px;\n        top: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 100%;\n          left: 50%;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(180deg);\n        }\n      "])), componentSizeAndPosition.left +
                componentSizeAndPosition.width / 2 -
                textContentSize.width / 2, componentSizeAndPosition.top -
                MARGIN -
                textContentSize.height, theme.components[COMPONENT_NAME].background);
        case "bottom":
            return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          bottom: 100%;\n          left: 50%;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n        }\n      "], ["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          bottom: 100%;\n          left: 50%;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n        }\n      "])), componentSizeAndPosition.bottom + MARGIN, componentSizeAndPosition.left +
                componentSizeAndPosition.width / 2 -
                textContentSize.width / 2, theme.components[COMPONENT_NAME].background);
        case "right":
            return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 50%;\n          right: 100%;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(-90deg);\n        }\n      "], ["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 50%;\n          right: 100%;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(-90deg);\n        }\n      "])), componentSizeAndPosition.height / 2 -
                textContentSize.height / 2 +
                componentSizeAndPosition.top, componentSizeAndPosition.left +
                MARGIN +
                componentSizeAndPosition.width, theme.components[COMPONENT_NAME].background);
        case "left":
            return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n        left: ", "px;\n        top: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 50%;\n          left: 100%;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(90deg);\n        }\n      "], ["\n        left: ", "px;\n        top: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 50%;\n          left: 100%;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(90deg);\n        }\n      "])), componentSizeAndPosition.left -
                MARGIN -
                textContentSize.width, componentSizeAndPosition.height / 2 -
                textContentSize.height / 2 +
                componentSizeAndPosition.top, theme.components[COMPONENT_NAME].background);
        case "bottomRight":
            return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          bottom: 100%;\n          right: 16px;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n        }\n      "], ["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          bottom: 100%;\n          right: 16px;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n        }\n      "])), componentSizeAndPosition.bottom + MARGIN, componentSizeAndPosition.right - textContentSize.width, theme.components[COMPONENT_NAME].background);
        case "bottomLeft":
            return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          bottom: 100%;\n          left: 16px;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n        }\n      "], ["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          bottom: 100%;\n          left: 16px;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n        }\n      "])), componentSizeAndPosition.bottom + MARGIN, componentSizeAndPosition.left, theme.components[COMPONENT_NAME].background);
        case "topLeft":
            return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 100%;\n          left: 16px;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(180deg);\n        }\n      "], ["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 100%;\n          left: 16px;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(180deg);\n        }\n      "])), componentSizeAndPosition.top -
                MARGIN -
                textContentSize.height, componentSizeAndPosition.left, theme.components[COMPONENT_NAME].background);
        case "topRight":
            return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 100%;\n          right: 16px;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(180deg);\n        }\n      "], ["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 100%;\n          right: 16px;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(180deg);\n        }\n      "])), componentSizeAndPosition.top -
                MARGIN -
                textContentSize.height, componentSizeAndPosition.right - textContentSize.width, theme.components[COMPONENT_NAME].background);
        default:
            return css(templateObject_9 || (templateObject_9 = __makeTemplateObject([""], [""])));
    }
};
export var PopoverStyled = 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 PopoverContentWrapper = styled.div.attrs(function (props) { return ({
    theme: getTheme({
        theme: props.theme,
        defaultTheme: defaultThemePopover,
        componentName: COMPONENT_NAME
    })
}); })(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n  position: absolute;\n\n  padding: 24px;\n  width: 320px;\n  display: flex;\n  flex-direction: column;\n  z-index: ", ";\n\n  ", ";\n\n  ", ";\n  ", "\n  ", ";\n  opacity: 0;\n\n  .buttonHolder {\n    display: flex;\n    justify-content: center;\n    gap: 16px;\n    margin-top: 16px;\n  }\n  .popoverHeader {\n    display: flex;\n    span {\n      word-wrap: break-word;\n    }\n    width: 280px;\n    flex-direction: column;\n    gap: 8px;\n  }\n\n  &.Popover-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: 24px;\n  width: 320px;\n  display: flex;\n  flex-direction: column;\n  z-index: ", ";\n\n  ", ";\n\n  ", ";\n  ", "\n  ", ";\n  opacity: 0;\n\n  .buttonHolder {\n    display: flex;\n    justify-content: center;\n    gap: 16px;\n    margin-top: 16px;\n  }\n  .popoverHeader {\n    display: flex;\n    span {\n      word-wrap: break-word;\n    }\n    width: 280px;\n    flex-direction: column;\n    gap: 8px;\n  }\n\n  &.Popover-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 theme = _a.theme;
    return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n      background: ", ";\n      color: ", ";\n    "], ["\n      background: ", ";\n      color: ", ";\n    "])), theme.components[COMPONENT_NAME].background, theme.components[COMPONENT_NAME].color);
}, function (_a) {
    var theme = _a.theme;
    return theme.shadows.hp.bottom;
}, BorderRadius.roundBorder("16px"), function (_a) {
    var direction = _a.direction, componentSizeAndPosition = _a.componentSizeAndPosition, textContentSize = _a.textContentSize, theme = _a.theme;
    return getDirectionStyles(direction, componentSizeAndPosition, textContentSize, theme);
});
PopoverContentWrapper.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;
