/*!
 *
 * carbon-angular v0.0.7 | progress-indicator.component.js
 *
 * Copyright 2014, 2019 IBM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


import { Component, Input } from "@angular/core";
import { ExperimentalService } from "./../experimental.module";
/**
 * [See demo](../../?path=/story/progress-indicator--basic)
 *
 * <example-url>../../iframe.html?id=progress-indicator--basic</example-url>
 */
var ProgressIndicator = /** @class */ (function () {
    function ProgressIndicator(experimental) {
        this.experimental = experimental;
        this.orientation = "horizontal";
        this.skeleton = false;
    }
    ProgressIndicator.skeletonSteps = function (stepCount) {
        var steps = [];
        for (var i = 0; i < stepCount; i++) {
            steps.push({ "state": ["incomplete"] });
        }
        return steps;
    };
    Object.defineProperty(ProgressIndicator.prototype, "current", {
        get: function () {
            return this.steps.findIndex(function (step) { return step.state.includes("current"); });
        },
        set: function (current) {
            if (current === undefined || current < 0) {
                for (var i = 0; i < this.steps.length; i++) {
                    this.steps[i].state[0] = "incomplete";
                }
                return;
            }
            if (current > this.steps.length - 1) {
                for (var i = 0; i < this.steps.length; i++) {
                    this.steps[i].state[0] = "complete";
                }
                return;
            }
            this.steps[current].state[0] = "current";
            for (var i = 0; i < current; i++) {
                this.steps[i].state[0] = "complete";
            }
            for (var i = current + 1; i < this.steps.length; i++) {
                this.steps[i].state[0] = "incomplete";
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ProgressIndicator.prototype, "isExperimental", {
        get: function () {
            return this.experimental.isExperimental;
        },
        enumerable: true,
        configurable: true
    });
    ProgressIndicator.decorators = [
        { type: Component, args: [{
                    selector: "ibm-progress-indicator",
                    template: "\n\t<ul\n\t\tdata-progress\n\t\tdata-progress-current\n\t\tclass=\"bx--progress\"\n\t\t[ngClass]=\"{\n\t\t\t'bx--skeleton': skeleton,\n\t\t\t'bx--progress--vertical': (orientation === 'vertical')\n\t\t}\">\n\t\t<li\n\t\t\tclass=\"bx--progress-step bx--progress-step--{{step.state[0]}}\"\n\t\t\t*ngFor=\"let step of steps\"\n\t\t\t[ngClass]=\"{'bx--progress-step--disabled' : step.disabled}\">\n\t\t\t<div class=\"bx--progress-step-button bx--progress-step-button--unclickable\" role=\"button\" tabindex=\"-1\">\n\t\t\t\t<ibm-icon-checkmark-outline16 *ngIf=\"step.state == 'complete'\"></ibm-icon-checkmark-outline16>\n\t\t\t\t<svg *ngIf=\"step.state == 'current'\">\n\t\t\t\t\t<path *ngIf=\"isExperimental\" d=\"M 7, 7 m -7, 0 a 7,7 0 1,0 14,0 a 7,7 0 1,0 -14,0\" ></path>\n\t\t\t\t</svg>\n\t\t\t\t<svg *ngIf=\"step.state == 'incomplete'\">\n\t\t\t\t\t<path\n\t\t\t\t\t\t*ngIf=\"isExperimental\"\n\t\t\t\t\t\td=\"M8 1C4.1 1 1 4.1 1 8s3.1 7 7 7 7-3.1 7-7-3.1-7-7-7zm0 13c-3.3 0-6-2.7-6-6s2.7-6 6-6 6 2.7 6 6-2.7 6-6 6z\">\n\t\t\t\t\t</path>\n\t\t\t\t</svg>\n\t\t\t\t<ibm-icon-warning16 *ngIf=\"step.state.includes('error')\" innerClass=\"bx--progress__warning\"></ibm-icon-warning16>\n\t\t\t\t<p\n\t\t\t\t\tclass=\"bx--progress-label\"\n\t\t\t\t\t*ngIf=\"step.tooltip\"\n\t\t\t\t\t[ibmTooltip]=\"step.tooltip.content\"\n\t\t\t\t\t[trigger]=\"step.tooltip.trigger\"\n\t\t\t\t\t[placement]=\"step.tooltip.placement\"\n\t\t\t\t\t[title]=\"step.tooltip.title\"\n\t\t\t\t\t[gap]=\"step.tooltip.gap\"\n\t\t\t\t\t[appendInline]=\"step.tooltip.appendInline\"\n\t\t\t\t\t[data]=\"step.tooltip.data\">\n\t\t\t\t\t{{step.text}}\n\t\t\t\t</p>\n\t\t\t\t<p class=\"bx--progress-label\" *ngIf=\"!step.tooltip\">{{step.text}}</p>\n\t\t\t\t<p *ngIf=\"step.optionalText\" class=\"bx--progress-optional\">{{step.optionalText}}</p>\n\t\t\t\t<span class=\"bx--progress-line\"></span>\n\t\t\t</div>\n\t\t</li>\n\t</ul>\n\t"
                },] },
    ];
    /** @nocollapse */
    ProgressIndicator.ctorParameters = function () { return [
        { type: ExperimentalService }
    ]; };
    ProgressIndicator.propDecorators = {
        steps: [{ type: Input }],
        orientation: [{ type: Input }],
        skeleton: [{ type: Input }],
        current: [{ type: Input }]
    };
    return ProgressIndicator;
}());
export { ProgressIndicator };
//# sourceMappingURL=progress-indicator.component.js.map