import { __makeTemplateObject } from "tslib";
import styled, { css } from "styled-components";
import { getTheme } from "../utils/theme/getTheme";
import { P1 } from "../typography";
import { Shape } from "../Pallette/Shape";
import { LIGHT_THEME } from "../Pallette/themes";
import { defaultThemeSegmentedControl } from "./theme";
var COMPONENT_NAME = "segmentedControl";
export var SegmentedControlWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n  display: flex;\n  width: 100%;\n"], ["\n  display: flex;\n  width: 100%;\n"])));
export var SegmentedControlBase = styled.div.attrs(function (props) { return ({
    theme: getTheme({
        theme: props.theme,
        defaultTheme: defaultThemeSegmentedControl,
        componentName: COMPONENT_NAME
    })
}); })(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n  width: 100%;\n  z-index: 0;\n  padding: 8px;\n  display: flex;\n  position: relative;\n  vertical-align: middle;\n  background-color: ", ";\n  ", "\n"], ["\n  width: 100%;\n  z-index: 0;\n  padding: 8px;\n  display: flex;\n  position: relative;\n  vertical-align: middle;\n  background-color: ", ";\n  ", "\n"])), function (_a) {
    var theme = _a.theme;
    return theme.components[COMPONENT_NAME].backgroundDefault;
}, function (_a) {
    var size = _a.size;
    switch (size) {
        case "l":
            return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n          height: 72px;\n          border-radius: 16px;\n          ", " {\n            border-radius: 16px;\n            height: 56px;\n          }\n        "], ["\n          height: 72px;\n          border-radius: 16px;\n          ", " {\n            border-radius: 16px;\n            height: 56px;\n          }\n        "])), Bracket);
        case "m":
            return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n          height: 64px;\n          border-radius: 16px;\n          ", " {\n            border-radius: 16px;\n            height: 48px;\n          }\n        "], ["\n          height: 64px;\n          border-radius: 16px;\n          ", " {\n            border-radius: 16px;\n            height: 48px;\n          }\n        "])), Bracket);
        case "s":
            return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n          height: 48px;\n          border-radius: 8px;\n          ", " {\n            border-radius: 8px;\n            height: 32px;\n          }\n        "], ["\n          height: 48px;\n          border-radius: 8px;\n          ", " {\n            border-radius: 8px;\n            height: 32px;\n          }\n        "])), Bracket);
        case "xs":
            return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n          height: 40px;\n          border-radius: 8px;\n          ", " {\n            border-radius: 8px;\n            height: 24px;\n          }\n        "], ["\n          height: 40px;\n          border-radius: 8px;\n          ", " {\n            border-radius: 8px;\n            height: 24px;\n          }\n        "])), Bracket);
    }
    return "";
});
export var ControlItem = styled(P1).attrs(function (props) { return ({
    theme: getTheme({
        theme: props.theme,
        defaultTheme: defaultThemeSegmentedControl,
        componentName: COMPONENT_NAME
    })
}); })(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n  height: 100%;\n  cursor: pointer;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  font-size: 16px;\n  gap: 12px;\n  line-height: 24px;\n  padding: 4px 8px;\n  min-width: 90px;\n  width: 100%;\n  vertical-align: middle;\n  background-color: transparent;\n  border-radius: ", ";\n  ", ";\n  z-index: 2;\n  & > svg {\n    color: currentColor;\n  }\n"], ["\n  height: 100%;\n  cursor: pointer;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  font-size: 16px;\n  gap: 12px;\n  line-height: 24px;\n  padding: 4px 8px;\n  min-width: 90px;\n  width: 100%;\n  vertical-align: middle;\n  background-color: transparent;\n  border-radius: ", ";\n  ", ";\n  z-index: 2;\n  & > svg {\n    color: currentColor;\n  }\n"])), Shape.borderRadiusMedium, function (_a) {
    var theme = _a.theme, isPressed = _a.isPressed, isDisabled = _a.isDisabled;
    if (isDisabled) {
        return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n        color: ", ";\n        cursor: not-allowed;\n      "], ["\n        color: ", ";\n        cursor: not-allowed;\n      "])), theme.components[COMPONENT_NAME].colorDisabled);
    }
    else if (isPressed) {
        return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n        color: ", ";\n      "], ["\n        color: ", ";\n      "])), theme.components[COMPONENT_NAME].colorPressed);
    }
    return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n      color: ", ";\n      :hover {\n        background: ", ";\n        color: ", ";\n      }\n    "], ["\n      color: ", ";\n      :hover {\n        background: ", ";\n        color: ", ";\n      }\n    "])), theme.components[COMPONENT_NAME].colorDefault, theme.components[COMPONENT_NAME].backgroundHover, theme.components[COMPONENT_NAME].colorHover);
});
export var Bracket = styled.div.attrs(function (props) { return ({
    theme: getTheme({
        theme: props.theme,
        defaultTheme: defaultThemeSegmentedControl,
        componentName: COMPONENT_NAME
    })
}); })(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n  z-index: 1;\n  position: absolute;\n  transition: left 0.3s;\n  background-color: ", ";\n  ", "\n"], ["\n  z-index: 1;\n  position: absolute;\n  transition: left 0.3s;\n  background-color: ", ";\n  ", "\n"])), function (_a) {
    var theme = _a.theme;
    return theme.components[COMPONENT_NAME].backgroundPressed;
}, function (_a) {
    var bracketPosition = _a.bracketPosition;
    return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n    left: ", "px;\n    width: ", "px;\n  "], ["\n    left: ", "px;\n    width: ", "px;\n  "])), bracketPosition.left, bracketPosition.width);
});
SegmentedControlBase.defaultProps = {
    theme: LIGHT_THEME
};
ControlItem.defaultProps = {
    theme: LIGHT_THEME
};
Bracket.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;
