All files / status-counter si-status-counter.component.ts

100% Statements 8/8
100% Branches 2/2
100% Functions 1/1
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37                            1x   6x   6x           6x   6x           6x   6x    
/**
 * Copyright (c) Siemens 2016 - 2025
 * SPDX-License-Identifier: MIT
 */
import { NgClass } from '@angular/common';
import { booleanAttribute, Component, computed, input, numberAttribute } from '@angular/core';
import { SiIconComponent } from '@siemens/element-ng/icon';
 
@Component({
  selector: 'si-status-counter, si-icon-status',
  imports: [NgClass, SiIconComponent],
  templateUrl: './si-status-counter.component.html',
  styleUrl: './si-status-counter.component.scss'
})
export class SiStatusCounterComponent {
  /** Icon to display. */
  readonly icon = input.required<string>();
  /** Stacked icon to display. */
  readonly stackedIcon = input<string>();
  /**
   * Counter below the icon
   *
   * @defaultValue 0
   */
  readonly count = input(0, { transform: numberAttribute });
  /** Color of the icon */
  readonly color = input<string>();
  /**
   * Whether the icon is disabled.
   *
   * @defaultValue false
   */
  readonly disabled = input(false, { transform: booleanAttribute });
 
  readonly isDisabledOrCountZero = computed(() => !!this.disabled() || this.count() === 0);
}