"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var styled_components_1 = __importDefault(require("styled-components"));
var styleConstants_1 = require("../../styleConstants");
var StyledLi = styled_components_1.default.li(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n  cursor: ", ";\n  box-sizing: border-box;\n  font-family: ", ";\n  font-weight: ", ";\n  margin-bottom: 0;\n  padding: 3px 0 18px;\n  text-align: center;\n  display: flex;\n  flex-direction: column;\n  justify-content: space-between;\n  align-items: center;\n  color: ", ";\n"], ["\n  cursor: ", ";\n  box-sizing: border-box;\n  font-family: ", ";\n  font-weight: ", ";\n  margin-bottom: 0;\n  padding: 3px 0 18px;\n  text-align: center;\n  display: flex;\n  flex-direction: column;\n  justify-content: space-between;\n  align-items: center;\n  color: ",
    ";\n"])), function (props) { return (props.disabled ? "default" : "pointer"); }, function (props) { return props.theme.sansSerifFont; }, function (props) { return (props.isCurrent ? 500 : 300); }, function (props) {
    if (props.isCurrent) {
        return props.theme.stepProccessTopNavCurrentColor;
    }
    else if (props.isActive) {
        return props.theme.stepProccessTopNavActiveColor;
    }
    else {
        return props.theme.stepProccessTopNavFutureColor;
    }
});
var Dot = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n  width: 10px;\n  height: 10px;\n  border-radius: 50%;\n  background-color: ", ";\n  margin: 0;\n  margin-bottom: 8px;\n  box-sizing: border-box;\n  ", ";\n"], ["\n  width: 10px;\n  height: 10px;\n  border-radius: 50%;\n  background-color: ",
    ";\n  margin: 0;\n  margin-bottom: 8px;\n  box-sizing: border-box;\n  ",
    ";\n"])), function (props) {
    return props.isActive ? props.theme.stepProcessDotActiveColor : props.theme.stepProcessDotFutureColor;
}, function (props) {
    return props.isCurrent
        ? "margin-left: -" + props.tailLength + "px;\n     width: " + (props.tailLength + 10 || 10) + "px;\n     border-radius: 10px;\n     "
        : "";
});
var CompleteDot = styled_components_1.default(Dot)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n  position: relative;\n  width: 21px;\n  height: 21px;\n  z-index: 10;\n  margin-top: -5px;\n  margin-left: -2px;\n  margin-bottom: 2px;\n  background-color: ", ";\n  border: 2px solid ", ";\n  ", " &:after {\n    content: \"\";\n    position: absolute;\n    left: 6px;\n    top: 2.5px;\n    width: 3px;\n    height: 7px;\n    border: solid white;\n    border-width: 0 1.5px 1.5px 0;\n    transform: rotate(45deg);\n  }\n"], ["\n  position: relative;\n  width: 21px;\n  height: 21px;\n  z-index: 10;\n  margin-top: -5px;\n  margin-left: -2px;\n  margin-bottom: 2px;\n  background-color: ", ";\n  border: 2px solid ", ";\n  ",
    " &:after {\n    content: \"\";\n    position: absolute;\n    left: 6px;\n    top: 2.5px;\n    width: 3px;\n    height: 7px;\n    border: solid white;\n    border-width: 0 1.5px 1.5px 0;\n    transform: rotate(45deg);\n  }\n"])), function (props) { return props.theme.stepProcessDotActiveColor; }, function (props) { return props.theme.stepProccessCompleteDotBorderColor; }, function (props) {
    return props.isCurrent ? "margin-left: " + (props.tailLength ? props.tailLength - 2 : -2) + "px;" : "";
});
StyledLi.defaultProps = {
    theme: {
        sansSerifFont: styleConstants_1.fonts.SANS_SERIF,
        stepProccessTopNavCurrentColor: "blue",
        stepProccessTopNavActiveColor: "#404040",
        stepProccessTopNavFutureColor: "#bbb",
    },
};
Dot.defaultProps = {
    theme: {
        stepProcessDotActiveColor: "blue",
        stepProcessDotFutureColor: "#ddd",
    },
};
CompleteDot.defaultProps = {
    theme: {
        stepProccessCompleteDotBorderColor: "#fff",
        stepProcessDotActiveColor: "blue",
    },
};
var Step = /** @class */ (function (_super) {
    __extends(Step, _super);
    function Step(props) {
        var _this = _super.call(this, props) || this;
        _this.state = {};
        return _this;
    }
    Step.prototype.componentDidMount = function () {
        if (this.props.setStartPosition) {
            this.props.setStartPosition(this.dot ? this.dot.offsetLeft : 0);
        }
        this.setState({ dotPosition: this.dot ? this.dot.offsetLeft : 0 });
    };
    Step.prototype.render = function () {
        var _this = this;
        var tailLength = this.state.dotPosition - this.props.startPosition;
        return (React.createElement(StyledLi, { onClick: function () { return !_this.props.disabled && _this.props.onClick(_this.props.index); }, isActive: this.props.isActive, isCurrent: this.props.isCurrent, disabled: this.props.disabled },
            React.createElement(Dot, { ref: function (el) { return (_this.dot = el); }, isActive: this.props.isActive, isCurrent: this.props.isCurrent, tailLength: tailLength }, this.props.complete && React.createElement(CompleteDot, { isCurrent: this.props.isCurrent, tailLength: tailLength })),
            " ",
            this.props.title));
    };
    return Step;
}(React.Component));
exports.Step = Step;
var templateObject_1, templateObject_2, templateObject_3;
//# sourceMappingURL=Step.js.map