All files / chat-messages si-chat-message.component.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 0/0
100% Lines 4/4

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 50 51 52 53 54 55 56 57                                                                          1x         30x           30x           30x    
/**
 * Copyright (c) Siemens 2016 - 2025
 * SPDX-License-Identifier: MIT
 */
import { Component, input } from '@angular/core';
import { SiResponsiveContainerDirective } from '@siemens/element-ng/resize-observer';
 
/**
 * Base chat message component that provides the layout structure for conversational interfaces.
 *
 * This component handles the core message layout including avatar positioning, loading states,
 * and action button placement. It serves as the foundation for more specialized message components
 * like {@link SiUserMessageComponent} and {@link SiAiMessageComponent}.
 *
 * @remarks
 * The component provides:
 * - Flexible alignment (start/end) for different message types
 * - Avatar/icon slot for message attribution
 * - Loading state with skeleton UI
 * - Action buttons positioned on the side or bottom
 * - Responsive behavior that adapts to container size
 * - Attachment display slot
 *
 * This is a low-level component typically not used directly. Instead, use the higher-level
 * message components that wrap this component with specific styling and behavior.
 *
 * @experimental
 */
@Component({
  selector: 'si-chat-message',
  templateUrl: './si-chat-message.component.html',
  styleUrl: './si-chat-message.component.scss',
  host: {
    class: 'd-block'
  },
  hostDirectives: [SiResponsiveContainerDirective]
})
export class SiChatMessageComponent {
  /**
   * Whether the message is currently loading
   * @defaultValue false
   */
  readonly loading = input(false);
 
  /**
   * Alignment of the message
   * @defaultValue 'start'
   */
  readonly alignment = input<'start' | 'end'>('start');
 
  /**
   * Where to display action buttons (if any)
   * @defaultValue 'side'
   */
  readonly actionsPosition = input<'side' | 'bottom'>('side');
}