(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "tslib", "styled-components", "../Pallette/themes", "../Pallette/style-utils", "../Pallette/fonts", "../Label", "../utils/theme/getTheme", "../utils/defineResponsibleSize", "./themes"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.LabelStyled = exports.IconWrapper = exports.SearchBoxStyled = exports.InputWrapper = exports.InputStyled = exports.ButtonStyled = exports.IconWrapperMarginRight = exports.IconWidth = exports.getHeight = void 0;
    var tslib_1 = require("tslib");
    var styled_components_1 = (0, tslib_1.__importStar)(require("styled-components"));
    var themes_1 = require("../Pallette/themes");
    var style_utils_1 = require("../Pallette/style-utils");
    var fonts_1 = require("../Pallette/fonts");
    var Label_1 = (0, tslib_1.__importDefault)(require("../Label"));
    var getTheme_1 = require("../utils/theme/getTheme");
    var defineResponsibleSize_1 = require("../utils/defineResponsibleSize");
    var themes_2 = require("./themes");
    var getHeight = function (size) {
        if (size === "m") {
            return "48px";
        }
        else {
            return "56px";
        }
    };
    exports.getHeight = getHeight;
    var HEIGHT = {
        m: "48px",
        l: "56px"
    };
    exports.IconWidth = 16;
    exports.IconWrapperMarginRight = 9;
    var COMPONENT_NAME = "searchBox";
    exports.ButtonStyled = styled_components_1.default.button.attrs(function (props) { return ({
        theme: (0, getTheme_1.getTheme)({
            theme: props.theme,
            defaultTheme: themes_2.defaultThemeSearchBox,
            componentName: COMPONENT_NAME
        })
    }); })(templateObject_1 || (templateObject_1 = (0, tslib_1.__makeTemplateObject)(["\n  position: relative;\n  border: none;\n  width: auto;\n  max-width: 100%;\n  background: transparent;\n  display: flex;\n  box-sizing: border-box;\n  align-items: baseline;\n  cursor: pointer;\n  svg {\n    color: ", ";\n  }\n\n  &.search-box__icon {\n    cursor: auto;\n    margin-left: 24px;\n  }\n"], ["\n  position: relative;\n  border: none;\n  width: auto;\n  max-width: 100%;\n  background: transparent;\n  display: flex;\n  box-sizing: border-box;\n  align-items: baseline;\n  cursor: pointer;\n  svg {\n    color: ", ";\n  }\n\n  &.search-box__icon {\n    cursor: auto;\n    margin-left: 24px;\n  }\n"])), function (_a) {
        var theme = _a.theme;
        return theme.components[COMPONENT_NAME].iconColor;
    });
    exports.ButtonStyled.defaultProps = {
        theme: themes_1.LIGHT_THEME
    };
    exports.InputStyled = styled_components_1.default.input.attrs(function (props) { return ({
        theme: (0, getTheme_1.getTheme)({
            theme: props.theme,
            defaultTheme: themes_2.defaultThemeSearchBox,
            componentName: COMPONENT_NAME
        })
    }); })(templateObject_2 || (templateObject_2 = (0, tslib_1.__makeTemplateObject)(["\n  border: none;\n  overflow: hidden;\n  background: transparent;\n  flex: 1;\n  outline: none;\n  color: ", ";\n  ", ";\n  ", ";\n\n  ::placeholder {\n    user-select: none;\n    color: ", ";\n  }\n\n  :hover {\n    color: ", ";\n    ::placeholder {\n      user-select: none;\n      color: ", ";\n    }\n  }\n\n  :disabled {\n    background: none;\n    cursor: not-allowed;\n    color: ", ";\n    \n    ::placeholder {\n      color: ", ";\n    }\n"], ["\n  border: none;\n  overflow: hidden;\n  background: transparent;\n  flex: 1;\n  outline: none;\n  color: ", ";\n  ", ";\n  ", ";\n\n  ::placeholder {\n    user-select: none;\n    color: ", ";\n  }\n\n  :hover {\n    color: ", ";\n    ::placeholder {\n      user-select: none;\n      color: ", ";\n    }\n  }\n\n  :disabled {\n    background: none;\n    cursor: not-allowed;\n    color: ", ";\n    \n    ::placeholder {\n      color: ", ";\n    }\n"])), function (_a) {
        var theme = _a.theme;
        return theme.components[COMPONENT_NAME].color;
    }, style_utils_1.Padding.allSide(1), fonts_1.corvusOnest, function (_a) {
        var theme = _a.theme;
        return theme.components[COMPONENT_NAME].colorPlaceholder;
    }, function (_a) {
        var theme = _a.theme;
        return theme.components[COMPONENT_NAME].colorHover;
    }, function (_a) {
        var theme = _a.theme;
        return theme.components[COMPONENT_NAME].colorHover;
    }, function (_a) {
        var theme = _a.theme;
        return theme.components[COMPONENT_NAME].colorDisabled;
    }, function (_a) {
        var theme = _a.theme;
        return theme.components[COMPONENT_NAME].colorDisabled;
    });
    exports.InputStyled.defaultProps = {
        theme: themes_1.LIGHT_THEME
    };
    exports.InputWrapper = styled_components_1.default.div.attrs(function (props) { return ({
        theme: (0, getTheme_1.getTheme)({
            theme: props.theme,
            defaultTheme: themes_2.defaultThemeSearchBox,
            componentName: COMPONENT_NAME
        })
    }); })(templateObject_21 || (templateObject_21 = (0, tslib_1.__makeTemplateObject)(["\n  ", ";\n\n  ", ";\n\n  ", ";\n\n  ", "\n\n  ", "\n  padding: 16px 20px;\n  width: 100%;\n  box-sizing: border-box;\n  font-weight: normal;\n  display: flex;\n  flex-direction: row;\n  align-items: center;\n  justify-content: space-between;\n  transition: all 0.1s ease-out;\n  cursor: text;\n\n  // read only \u043F\u043E\u043B\u0435\u0437\u043D\u043E \u0433\u0434\u0435 \u043D\u0443\u0436\u043D\u043E \u043F\u0440\u043E\u0441\u0442\u043E \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u0430 \u043D\u043E \u043D\u0435 \u043D\u0443\u0436\u043D\u0430 \u043B\u043E\u0433\u0438\u043A\u0430\n  ", "\n\n  &:hover {\n    ", "\n  }\n\n  ", "\n"], ["\n  ", ";\n\n  ", ";\n\n  ", ";\n\n  ", "\n\n  ", "\n  padding: 16px 20px;\n  width: 100%;\n  box-sizing: border-box;\n  font-weight: normal;\n  display: flex;\n  flex-direction: row;\n  align-items: center;\n  justify-content: space-between;\n  transition: all 0.1s ease-out;\n  cursor: text;\n\n  // read only \u043F\u043E\u043B\u0435\u0437\u043D\u043E \u0433\u0434\u0435 \u043D\u0443\u0436\u043D\u043E \u043F\u0440\u043E\u0441\u0442\u043E \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u0430 \u043D\u043E \u043D\u0435 \u043D\u0443\u0436\u043D\u0430 \u043B\u043E\u0433\u0438\u043A\u0430\n  ", "\n\n  &:hover {\n    ", "\n  }\n\n  ", "\n"])), function (_a) {
        var theme = _a.theme, size = _a.size, viewType = _a.viewType;
        return (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = (0, tslib_1.__makeTemplateObject)(["\n    ", "\n    height: ", ";\n    color: ", ";\n    & div > svg {\n      color: ", ";\n    }\n  "], ["\n    ", "\n    height: ", ";\n    color: ", ";\n    & div > svg {\n      color: ", ";\n    }\n  "])), viewType === "round"
            ? (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = (0, tslib_1.__makeTemplateObject)(["\n          background-color: ", ";\n        "], ["\n          background-color: ", ";\n        "])), theme.components[COMPONENT_NAME].background) : (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = (0, tslib_1.__makeTemplateObject)(["\n          border-bottom: 1px solid\n            ", ";\n        "], ["\n          border-bottom: 1px solid\n            ", ";\n        "])), theme.components[COMPONENT_NAME].borderColor), HEIGHT[size], theme.components[COMPONENT_NAME].color, theme.components[COMPONENT_NAME].iconColor);
    }, function (_a) {
        var theme = _a.theme, viewType = _a.viewType, isHasValue = _a.isHasValue;
        return isHasValue &&
            viewType === "line" && (0, styled_components_1.css)(templateObject_6 || (templateObject_6 = (0, tslib_1.__makeTemplateObject)(["\n      border-bottom: 1px solid\n        ", ";\n    "], ["\n      border-bottom: 1px solid\n        ", ";\n    "])), theme.components[COMPONENT_NAME].borderColorValue);
    }, function (_a) {
        var theme = _a.theme, status = _a.status, viewType = _a.viewType;
        if (status === "error") {
            if (viewType === "round") {
                return (0, styled_components_1.css)(templateObject_7 || (templateObject_7 = (0, tslib_1.__makeTemplateObject)(["\n          background: ", ";\n        "], ["\n          background: ", ";\n        "])), theme.components[COMPONENT_NAME].backgroundError);
            }
            else {
                return (0, styled_components_1.css)(templateObject_8 || (templateObject_8 = (0, tslib_1.__makeTemplateObject)(["\n          border-bottom: 1px solid\n            ", ";\n        "], ["\n          border-bottom: 1px solid\n            ", ";\n        "])), theme.components[COMPONENT_NAME].colorError);
            }
        }
        return null;
    }, function (_a) {
        var status = _a.status, isFocused = _a.isFocused;
        return status &&
            isFocused && (0, styled_components_1.css)(templateObject_9 || (templateObject_9 = (0, tslib_1.__makeTemplateObject)(["\n      & div > svg {\n        display: none;\n      }\n    "], ["\n      & div > svg {\n        display: none;\n      }\n    "])));
    }, function (_a) {
        var viewType = _a.viewType;
        return viewType === "round" && (0, styled_components_1.css)(templateObject_10 || (templateObject_10 = (0, tslib_1.__makeTemplateObject)(["\n      border-radius: 16px;\n    "], ["\n      border-radius: 16px;\n    "])));
    }, function (_a) {
        var isReadOnly = _a.isReadOnly, theme = _a.theme, viewType = _a.viewType;
        if (isReadOnly) {
            if (viewType === "round") {
                return (0, styled_components_1.css)(templateObject_11 || (templateObject_11 = (0, tslib_1.__makeTemplateObject)(["\n          background-color: ", ";\n          border: 0;\n        "], ["\n          background-color: ", ";\n          border: 0;\n        "])), theme.components[COMPONENT_NAME]
                    .backgroundReadOnly);
            }
            else {
                return (0, styled_components_1.css)(templateObject_12 || (templateObject_12 = (0, tslib_1.__makeTemplateObject)(["\n          border-bottom: 1px solid\n            ", ";\n        "], ["\n          border-bottom: 1px solid\n            ", ";\n        "])), theme.components[COMPONENT_NAME].borderColorDisabled);
            }
        }
        return null;
    }, function (_a) {
        var error = _a.error, isDisabled = _a.isDisabled, isFocused = _a.isFocused, theme = _a.theme, status = _a.status, viewType = _a.viewType;
        return !isFocused &&
            !error &&
            !isDisabled &&
            !status && (0, styled_components_1.css)(templateObject_14 || (templateObject_14 = (0, tslib_1.__makeTemplateObject)(["\n        color: ", ";\n        ", "\n        & div > svg {\n          color: ", ";\n        }\n        & ", " {\n          ::placeholder {\n            color: ", ";\n          }\n        }\n      "], ["\n        color: ", ";\n        ", "\n        & div > svg {\n          color: ", ";\n        }\n        & ", " {\n          ::placeholder {\n            color: ", ";\n          }\n        }\n      "])), theme.components[COMPONENT_NAME].colorHover, viewType === "round" && (0, styled_components_1.css)(templateObject_13 || (templateObject_13 = (0, tslib_1.__makeTemplateObject)(["\n          background: ", ";\n        "], ["\n          background: ", ";\n        "])), theme.components[COMPONENT_NAME].backgroundHover), theme.components[COMPONENT_NAME].iconColorHover, exports.InputStyled, theme.components[COMPONENT_NAME].colorHover);
    }, function (_a) {
        var isFocused = _a.isFocused, isDisabled = _a.isDisabled, status = _a.status, theme = _a.theme, viewType = _a.viewType;
        if (isFocused && !status) {
            return (0, styled_components_1.css)(templateObject_17 || (templateObject_17 = (0, tslib_1.__makeTemplateObject)(["\n        ", "\n        & div > svg {\n          display: none;\n        }\n      "], ["\n        ", "\n        & div > svg {\n          display: none;\n        }\n      "])), viewType === "round"
                ? (0, styled_components_1.css)(templateObject_15 || (templateObject_15 = (0, tslib_1.__makeTemplateObject)(["\n              background: ", ";\n            "], ["\n              background: ", ";\n            "])), theme.components[COMPONENT_NAME].backgroundFocused) : (0, styled_components_1.css)(templateObject_16 || (templateObject_16 = (0, tslib_1.__makeTemplateObject)(["\n              border-bottom: 1px solid\n                ", ";\n            "], ["\n              border-bottom: 1px solid\n                ", ";\n            "])), theme.components[COMPONENT_NAME].borderColorFocused));
        }
        if (isDisabled) {
            return (0, styled_components_1.css)(templateObject_20 || (templateObject_20 = (0, tslib_1.__makeTemplateObject)(["\n        cursor: not-allowed;\n        ", "\n        & div > span {\n          color: ", ";\n        }\n        & ", " {\n          & svg {\n            color: ", ";\n          }\n        }\n}\n      "], ["\n        cursor: not-allowed;\n        ", "\n        & div > span {\n          color: ", ";\n        }\n        & ", " {\n          & svg {\n            color: ", ";\n          }\n        }\n}\n      "])), viewType === "round"
                ? (0, styled_components_1.css)(templateObject_18 || (templateObject_18 = (0, tslib_1.__makeTemplateObject)(["\n                background: ", ";\n              "], ["\n                background: ", ";\n              "])), theme.components[COMPONENT_NAME]
                    .backgroundDisabled) : (0, styled_components_1.css)(templateObject_19 || (templateObject_19 = (0, tslib_1.__makeTemplateObject)(["\n                border-bottom: 1px solid\n                  ", ";\n              "], ["\n                border-bottom: 1px solid\n                  ", ";\n              "])), theme.components[COMPONENT_NAME].borderColorDisabled), theme.components[COMPONENT_NAME].iconColorDisabled, exports.ButtonStyled, theme.components[COMPONENT_NAME].iconColorDisabled);
        }
        return "";
    });
    exports.InputWrapper.defaultProps = {
        theme: themes_1.LIGHT_THEME
    };
    exports.SearchBoxStyled = styled_components_1.default.div(templateObject_22 || (templateObject_22 = (0, tslib_1.__makeTemplateObject)(["\n  display: flex;\n  ", "\n  flex-direction: column;\n"], ["\n  display: flex;\n  ", "\n  flex-direction: column;\n"])), function (_a) {
        var width = _a.width;
        return (0, defineResponsibleSize_1.defineResponsibleWidth)(width);
    });
    exports.SearchBoxStyled.defaultProps = {
        theme: themes_1.LIGHT_THEME
    };
    exports.IconWrapper = styled_components_1.default.div(templateObject_23 || (templateObject_23 = (0, tslib_1.__makeTemplateObject)(["\n  display: flex;\n  margin-right: ", "px;\n"], ["\n  display: flex;\n  margin-right: ", "px;\n"])), exports.IconWrapperMarginRight);
    exports.IconWrapper.defaultProps = {
        theme: themes_1.LIGHT_THEME
    };
    exports.LabelStyled = (0, styled_components_1.default)(Label_1.default)(templateObject_24 || (templateObject_24 = (0, tslib_1.__makeTemplateObject)(["\n  ", ";\n  ", "\n"], ["\n  ", ";\n  ", "\n"])), style_utils_1.Padding.left(6), style_utils_1.Margin.allSide(1, 0));
    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, templateObject_23, templateObject_24;
});
