import ComponentBaseStyles from "../styles/ComponentBaseStyles.wrn" component ChatBubble { outputs { action(payload: { action: boolean; item: string | number | boolean | null | object; index: number }) messageClick(payload: { item: string | number | boolean | null | object; index: number; direction: string }) avatarClick(payload: { item: string | number | boolean | null | object; index: number; direction: string }) linkClick(payload: { link: string | number | boolean | null | object; item: string | number | boolean | null | object; index: number }) } props { size: string = "default" color: string = "primary" title: string = "" description: string = "" items: unknown[] = [] oneSided: boolean = false showAvatars: boolean = false showMetadata: boolean = false ariaLabel: string = "Conversation" variant: string = "default" class: string = "" } functions { shared function messageDirection(item) { return item.direction === "outgoing" ? "outgoing" : "incoming" } client function selectMessage(item, index) { output.messageClick({ item: item, index: index, direction: messageDirection(item) }) } client function selectAvatar(sourceEvent, item, index) { sourceEvent.stopPropagation() output.avatarClick({ item: item, index: index, direction: messageDirection(item) }) } client function selectLink(sourceEvent, link, item, index) { sourceEvent.stopPropagation() output.linkClick({ link: link, item: item, index: index }) } client function selectAction(sourceEvent, item, index) { sourceEvent.stopPropagation() output.action({ action: item.action || "retry", item: item, index: index }) } } view {
{#if title || description}
{#if title}

{title}

{/if} {#if description}

{description}

{/if}
{/if} {#if items.length}
{#each items as item, index}
{#if showAvatars && (item.avatarSrc || item.avatarFallback)} {/if}
{#if item.title}

{item.title}

{/if} {#if item.text}

{item.text}

{/if} {#if item.bullets && item.bullets.length}
    {#each item.bullets as bullet}
  • {bullet}
  • {/each}
{/if} {#if item.links && item.links.length} {/if}
{#if showMetadata && (item.timestamp || item.status || item.actionLabel)}
{#if item.statusIcon}{/if} {#if item.status}{item.status}{/if} {#if item.timestamp}{/if} {#if item.actionLabel} {/if}
{/if}
{/each}
{/if}