import { Component, Input } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "./components/progressbar-determinate/progressbar-determinate.component";
import * as i2 from "./components/progressbar-indeterminate/progressbar-indeterminate.component";
/**
 * @description Componente de barra de progresso que representa visualmente o avanço de uma tarefa.
 * Suporta modo determinado (valor percentual) e indeterminado (progresso desconhecido),
 * além de um valor-alvo para comparação.
 *
 * @example
 * ```html
 * <s-progressbar
 *   [value]="75"
 *   activeColor="blue"
 *   label="Upload"
 *   [showValue]="true"
 * />
 * ```
 *
 * @category Feedback
 */
export class ProgressBarComponent {
    /**
     * @description Valor atual do progresso, em percentual (0 a 100).
     * Não utilizado quando `mode` é `'indeterminate'`.
     * Lança erro se o valor estiver fora do intervalo permitido.
     */
    value;
    /**
     * @description Cor ativa da barra de progresso. Campo obrigatório.
     * Valores aceitos: `'blue'`, `'green'`, `'red'`, `'yellow'`.
     */
    activeColor;
    /**
     * @description Opções de formatação numérica utilizadas para exibir o valor percentual.
     * Baseado na API `Intl.NumberFormat`.
     *
     * @default `{ style: 'decimal', minimumFractionDigits: 0, maximumFractionDigits: 2 }`
     */
    numberFormatOptions = {
        style: 'decimal',
        minimumFractionDigits: 0,
        maximumFractionDigits: 2,
        roundingMode: 'trunc',
    };
    /**
     * @description Valor-alvo em percentual (0 a 100), exibido como marcador de referência na barra.
     * Não utilizado quando `mode` é `'indeterminate'`.
     */
    targetValue;
    /** @description Rótulo descritivo exibido ao lado da barra de progresso principal. */
    label;
    /** @description Rótulo descritivo exibido ao lado do marcador de valor-alvo. */
    targetLabel;
    /**
     * @description Quando `true`, exibe o valor percentual atual sobre ou próximo da barra.
     *
     * @default true
     */
    showValue = true;
    /**
     * @description Modo de operação da barra de progresso.
     * - `'determinate'`: exibe o progresso baseado em `value` (padrão).
     * - `'indeterminate'`: animação contínua sem valor definido; `value`, `targetValue` e `targetLabel` não devem ser usados.
     *
     * @default 'determinate'
     */
    mode = 'determinate';
    ngOnInit() {
        this.validateInputs();
    }
    validateInputs() {
        if (this.value < 0 || this.value > 100) {
            throw new Error('Invalid value for value');
        }
        if (this.targetValue && (this.targetValue < 0 || this.targetValue > 100)) {
            throw new Error('Invalid value for targetValue');
        }
        if (this.mode === 'indeterminate' && (this.value || this.targetValue || this.targetLabel)) {
            throw new Error('When the mode is indeterminate, the value, targetValue and targetLabel parameters are not expected.');
        }
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ProgressBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: ProgressBarComponent, selector: "s-progressbar", inputs: { value: "value", activeColor: "activeColor", numberFormatOptions: "numberFormatOptions", targetValue: "targetValue", label: "label", targetLabel: "targetLabel", showValue: "showValue", mode: "mode" }, ngImport: i0, template: "@if (mode === 'determinate') {\n    <s-progressbar-determinate\n        [value]=\"value\"\n        [numberFormatOptions]=\"numberFormatOptions\"\n        [targetValue]=\"targetValue\"\n        [targetLabel]=\"targetLabel\"\n        [activeColor]=\"activeColor\"\n        [showValue]=\"showValue\"\n    >\n    </s-progressbar-determinate>\n} @else {\n    <s-progressbar-indeterminate\n        [activeColor]=\"activeColor\"\n        [label]=\"label\"\n    >\n    </s-progressbar-indeterminate>\n}\n", styles: [".progress-bar{position:relative}.progress-bar .progress-bar-all{background-color:#d8d8d8;border-radius:4px;height:24px;overflow:hidden;width:100%}.progress-bar .progress-bar-all .progress-bar-active{align-items:center;color:#fff;display:flex;font-family:Open Sans,sans-serif;font-size:14px;height:100%;justify-content:center;line-height:150%;-webkit-user-select:none;user-select:none;width:80%}.progress-bar .progress-bar-all .progress-bar-active--blue{background-color:#428bca}.progress-bar .progress-bar-all .progress-bar-active--green{background-color:#0c9348}.progress-bar .progress-bar-all .progress-bar-active--red{background-color:#c13018}.progress-bar .progress-bar-all .progress-bar-active--yellow{background-color:#fcbf10}.progress-bar .target{align-items:flex-start;bottom:-38px;display:flex;flex-direction:column;position:absolute}.progress-bar .target .target-line{background-color:#333;height:40px;margin:8px 0;width:1px}.progress-bar .target .target-label{background-color:#426e78;border-radius:10px;color:#e5eaea;font-family:Open Sans,sans-serif;font-size:12px;line-height:150%;padding:2px 12px}\n"], dependencies: [{ kind: "component", type: i1.ProgressBarDeterminateComponent, selector: "s-progressbar-determinate", inputs: ["value", "activeColor", "numberFormatOptions", "targetValue", "targetLabel", "showValue"] }, { kind: "component", type: i2.ProgressBarIndeterminateComponent, selector: "s-progressbar-indeterminate", inputs: ["activeColor", "label"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ProgressBarComponent, decorators: [{
            type: Component,
            args: [{ selector: 's-progressbar', template: "@if (mode === 'determinate') {\n    <s-progressbar-determinate\n        [value]=\"value\"\n        [numberFormatOptions]=\"numberFormatOptions\"\n        [targetValue]=\"targetValue\"\n        [targetLabel]=\"targetLabel\"\n        [activeColor]=\"activeColor\"\n        [showValue]=\"showValue\"\n    >\n    </s-progressbar-determinate>\n} @else {\n    <s-progressbar-indeterminate\n        [activeColor]=\"activeColor\"\n        [label]=\"label\"\n    >\n    </s-progressbar-indeterminate>\n}\n", styles: [".progress-bar{position:relative}.progress-bar .progress-bar-all{background-color:#d8d8d8;border-radius:4px;height:24px;overflow:hidden;width:100%}.progress-bar .progress-bar-all .progress-bar-active{align-items:center;color:#fff;display:flex;font-family:Open Sans,sans-serif;font-size:14px;height:100%;justify-content:center;line-height:150%;-webkit-user-select:none;user-select:none;width:80%}.progress-bar .progress-bar-all .progress-bar-active--blue{background-color:#428bca}.progress-bar .progress-bar-all .progress-bar-active--green{background-color:#0c9348}.progress-bar .progress-bar-all .progress-bar-active--red{background-color:#c13018}.progress-bar .progress-bar-all .progress-bar-active--yellow{background-color:#fcbf10}.progress-bar .target{align-items:flex-start;bottom:-38px;display:flex;flex-direction:column;position:absolute}.progress-bar .target .target-line{background-color:#333;height:40px;margin:8px 0;width:1px}.progress-bar .target .target-label{background-color:#426e78;border-radius:10px;color:#e5eaea;font-family:Open Sans,sans-serif;font-size:12px;line-height:150%;padding:2px 12px}\n"] }]
        }], propDecorators: { value: [{
                type: Input
            }], activeColor: [{
                type: Input,
                args: [{ required: true }]
            }], numberFormatOptions: [{
                type: Input
            }], targetValue: [{
                type: Input
            }], label: [{
                type: Input
            }], targetLabel: [{
                type: Input
            }], showValue: [{
                type: Input
            }], mode: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 