import { h } from "@stencil/core";
export class TransactionListItem {
    renderPrimaryIcon() {
        if (!this.transaction.asset) {
            return h("mvx-default-transaction-icon-large", null);
        }
        if (this.transaction.asset.imageUrl) {
            return h("img", { src: this.transaction.asset.imageUrl, alt: "Transaction icon", class: "icon-image", loading: "lazy" });
        }
        if (this.transaction.asset.icon) {
            return h("mvx-fa-icon", { icon: this.transaction.asset.icon, class: "icon-text" });
        }
        if (this.transaction.asset.text) {
            return h("span", { class: "icon-text" }, this.transaction.asset.text);
        }
        return h("mvx-default-transaction-icon-large", null);
    }
    renderDetails() {
        return (h("div", { class: "transaction-details-info" }, this.transaction.directionLabel && h("span", { class: "transaction-details-info-text" }, this.transaction.directionLabel), h("div", { class: "transaction-details-info-icon" }, this.transaction.interactorAsset ? h("img", { src: this.transaction.interactorAsset, alt: "Service icon", loading: "lazy" }) : h("mvx-default-transaction-icon-small", null)), h("mvx-trim-text", { text: this.transaction.interactor, class: "transaction-details-info-text" })));
    }
    render() {
        if (!this.transaction) {
            return null;
        }
        return (h("div", { class: "transaction-item" }, h("div", { class: "transaction-icon" }, this.renderPrimaryIcon()), h("div", { class: "transaction-details" }, h("div", { class: "transaction-details-header" }, h("h4", { class: "transaction-title" }, this.transaction.action.name), this.transaction.amount && (h("div", { class: {
                'transaction-amount': true,
                'amount-negative': this.transaction.amount.startsWith('-'),
                'amount-positive': !this.transaction.amount.startsWith('-'),
            } }, this.transaction.amount))), this.renderDetails())));
    }
    static get is() { return "mvx-transaction-list-item"; }
    static get originalStyleUrls() {
        return {
            "$": ["transaction-list-item.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["transaction-list-item.css"]
        };
    }
    static get properties() {
        return {
            "transaction": {
                "type": "unknown",
                "attribute": "transaction",
                "mutable": false,
                "complexType": {
                    "original": "ITransactionListItem",
                    "resolved": "ITransactionListItem",
                    "references": {
                        "ITransactionListItem": {
                            "location": "import",
                            "path": "./transaction-list-item.types",
                            "id": "src/components/visual/transaction-list-item/transaction-list-item.types.ts::ITransactionListItem"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false
            }
        };
    }
}
//# sourceMappingURL=transaction-list-item.js.map
