/**
 * Copyright Aquera Inc 2023
 *
 * This source code is licensed under the BSD-3-Clause license found in the
 * LICENSE file in the root directory of this source tree.
 */
import { __decorate } from "tslib";
import { nothing, html } from 'lit';
import { customElement, state, property } from 'lit/decorators.js';
import { styles } from './nile-vertical-stepper-item.css';
import NileElement from '../internal/nile-element';
import { classMap } from 'lit/directives/class-map.js';
/**
 * Nile vertical-stepper-item component.
 *
 * @tag nile-vertical-stepper-item
 *
 */
let NileVerticalStepperItem = class NileVerticalStepperItem extends NileElement {
    constructor() {
        super(...arguments);
        /* Properties passed directly */
        this.title = '';
        this.subtitle = '';
        this.completed = false;
        this.current = false;
        /* Properties passed to parent component: NileStepper */
        this.contentBelow = false;
        this.size = 'lg';
        this.icon = 'tick';
        /* Properties Computed at parent level component NileStepper */
        this.isFirst = false;
        this.isLast = false;
        this.isComplete = false;
        this.isCurrent = false;
        this.isManualMode = false;
        this.haveFlex = true;
        /* #endregion */
    }
    /**
     * The styles for nile-vertical-stepper-item
     * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
     */
    static get styles() {
        return [styles];
    }
    /* #endregion */
    /* #region Methods */
    /**
     * Render method
     * @slot This is a slot test
     */
    render() {
        if (this.isLast)
            this.style.setProperty('--vertical-stepper-flex-val', `0`);
        const isCurrent = this.isManualMode ? this.current : this.isCurrent;
        const isComplete = this.isManualMode ? this.completed : this.isComplete;
        let showCompletedIcon = false;
        if (isComplete && !isCurrent || this.completedStepValue == this.value)
            showCompletedIcon = true;
        let suffixStepperLineActive = false;
        if (isComplete) {
            suffixStepperLineActive = true;
            if (this.calculatedCompletedStepValue == this.value)
                suffixStepperLineActive = false;
        }
        let iconSize = this.size == 'sm' ? 14 : this.size == 'lg' ? 16 : 20;
        return html `
			<div 
			part="item"
			class="${classMap({
            'stepper__item': true,
            'stepper__item--selected': isCurrent,
            'stepper__item--default': !isCurrent,
            'stepper__item--sm': this.size == 'sm',
            'stepper__item--lg': this.size == 'lg',
        })}">
				<div part="connector" class="stepper-item__connector-content">
					<div part="bulletin" class="stepper__item__bulletin">
						${showCompletedIcon ?
            html `<div part="bulletin-icon" class="${classMap({ 'stepper__bulletin--icon': true, 'stepper__bulletin__icon--active': isCurrent })}">${this.getSvg()}</div>`
            : html `<div part="bulletin-dot" class="${classMap({ 'stepper__bulletin--dot': true, 'stepper__bulletin__dot--active': isCurrent })}"></div>`}
					</div>
					<div part="line-container" class="stepper__item__line__container">
						${this.isLast ? nothing : html `<div part="line" class="${classMap({ 'stepper__item__line': true, 'stepper__item__line--active': suffixStepperLineActive })}"></div>`}
					</div>
				</div>
				<div part="content" class="stepper__item__content">
					<div part="title" class="${classMap({ 'stepper__content__title': true, "stepper__content__title--alone": !this.subtitle, 'stepper__content__title--active': isCurrent })}">${this.title}</div>
					<div part="subtitle" class="${classMap({ 'stepper__content__subtitle': true, "stepper__content__subtitle--alone": !this.title, 'stepper__content__subtitle--active': isCurrent })}">${this.subtitle}</div>
				</div>
			</div>
			`;
    }
    getSvg() {
        let iconSize = this.size == 'sm' ? 20 : this.size == 'lg' ? 24 : 28;
        return html `
		<svg part="bulletin-svg" width="${iconSize}" height="${iconSize}" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
			<path fill-rule="evenodd" clip-rule="evenodd" d="M22.7953 9.85334L13.2487 19.0667L10.7153 16.36C10.2487 15.92 9.51534 15.8933 8.982 16.2667C8.462 16.6533 8.31534 17.3333 8.63534 17.88L11.6353 22.76C11.9287 23.2133 12.4353 23.4933 13.0087 23.4933C13.5553 23.4933 14.0753 23.2133 14.3687 22.76C14.8487 22.1333 24.0087 11.2133 24.0087 11.2133C25.2087 9.98668 23.7553 8.90668 22.7953 9.84001V9.85334Z" fill="white"/>
		</svg>
		`;
    }
};
__decorate([
    property({ attribute: true, reflect: true })
], NileVerticalStepperItem.prototype, "title", void 0);
__decorate([
    property({ attribute: true, reflect: true })
], NileVerticalStepperItem.prototype, "subtitle", void 0);
__decorate([
    property({ attribute: true, reflect: true })
], NileVerticalStepperItem.prototype, "completed", void 0);
__decorate([
    property({ attribute: true, reflect: true })
], NileVerticalStepperItem.prototype, "current", void 0);
__decorate([
    state()
], NileVerticalStepperItem.prototype, "contentBelow", void 0);
__decorate([
    state()
], NileVerticalStepperItem.prototype, "size", void 0);
__decorate([
    state()
], NileVerticalStepperItem.prototype, "icon", void 0);
__decorate([
    state()
], NileVerticalStepperItem.prototype, "isFirst", void 0);
__decorate([
    state()
], NileVerticalStepperItem.prototype, "isLast", void 0);
__decorate([
    state()
], NileVerticalStepperItem.prototype, "isComplete", void 0);
__decorate([
    state()
], NileVerticalStepperItem.prototype, "isCurrent", void 0);
__decorate([
    state()
], NileVerticalStepperItem.prototype, "isManualMode", void 0);
__decorate([
    state()
], NileVerticalStepperItem.prototype, "currentStepValue", void 0);
__decorate([
    state()
], NileVerticalStepperItem.prototype, "completedStepValue", void 0);
__decorate([
    state()
], NileVerticalStepperItem.prototype, "calculatedCompletedStepValue", void 0);
__decorate([
    state()
], NileVerticalStepperItem.prototype, "value", void 0);
__decorate([
    state()
], NileVerticalStepperItem.prototype, "haveFlex", void 0);
NileVerticalStepperItem = __decorate([
    customElement('nile-vertical-stepper-item')
], NileVerticalStepperItem);
export { NileVerticalStepperItem };
export default NileVerticalStepperItem;
//# sourceMappingURL=nile-vertical-stepper-item.js.map