All files / element-ng/loading-spinner si-loading-spinner.component.ts

100% Statements 10/10
100% Branches 12/12
100% Functions 2/2
100% Lines 5/5

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 38 39 40 41 42 43 44 45 46 47 48 49                                44x           20x               20x                     20x         20x    
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { booleanAttribute, Component, input } from '@angular/core';
import { SiTranslatePipe, t, TranslatableString } from '@siemens/element-translate-ng/translate';
 
@Component({
  selector: 'si-loading-spinner',
  imports: [SiTranslatePipe],
  templateUrl: './si-loading-spinner.component.html',
  styleUrl: './si-loading-spinner.component.scss',
  host: {
    'animate.leave': 'spinner-leave'
  }
})
export class SiLoadingSpinnerComponent {
  /**
   * Whether the spinner blocks interaction with the surrounding content.
   *
   * @defaultValue false
   */
  readonly isBlockingSpinner = input(false, {
    transform: booleanAttribute
  });
  /**
   * Whether the spinner is displayed as an overlay.
   *
   * @defaultValue false
   */
  readonly isSpinnerOverlay = input(false, {
    transform: booleanAttribute
  });
  /**
   * Needed for a11y
   *
   * @defaultValue
   * ```
   * t(() => $localize`:@@SI_LOADING_SPINNER.LABEL:Loading`)
   * ```
   */
  readonly ariaLabel = input(t(() => $localize`:@@SI_LOADING_SPINNER.LABEL:Loading`));
 
  /**
   * Optional text to be displayed below the spinner.
   */
  readonly loadingText = input<TranslatableString>();
}