component Card { outputs { click(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object }) action(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object }) navigate(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object }) dismiss(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object }) load(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object }) error(payload: { error: Error | string; sourceEvent?: Event; [key: string]: string | number | boolean | null | object } | Error | string) } props { title: string = "Card title" subtitle: string = "" description: string = "" header: string = "" footer: string = "" imageSrc: string = "" imageAlt: string = "" imagePosition: string = "top" actionLabel: string = "" actionHref: string = "" headerActions: unknown[] = [] navigation: unknown[] = [] activeNav: string = "" mobileNavigation: boolean = false alertTitle: string = "" alertDescription: string = "" empty: boolean = false emptyTitle: string = "No data to show" emptyIcon: string = "icon-[lucide--inbox]" items: unknown[] = [] size: string = "md" color: string = "primary" variant: string = "default" layout: string = "vertical" align: string = "left" hover: string = "none" scrollable: boolean = false maxHeight: string = "18rem" dismissible: boolean = false ariaLabel: string = "" class: string = "" } state dismissed: boolean = false functions { client function dispatchCardNavigation(sourceEvent, item, index, root, customEvent) { root = sourceEvent.currentTarget.closest("[data-wrn-card]") if (!root) { return } customEvent = document.createEvent("CustomEvent") customEvent.initCustomEvent("navigate", true, false, { component: "Card", item: item, index: index }) root.dispatchEvent(customEvent) } client function dispatchCardNavigationValue(sourceEvent, root, customEvent) { root = sourceEvent.currentTarget.closest("[data-wrn-card]") if (!root) { return } customEvent = document.createEvent("CustomEvent") customEvent.initCustomEvent("navigate", true, false, { component: "Card", value: sourceEvent.currentTarget.value }) root.dispatchEvent(customEvent) } client function dispatchCardHeaderAction(sourceEvent, action, index, root, customEvent) { root = sourceEvent.currentTarget.closest("[data-wrn-card]") if (!root) { return } customEvent = document.createEvent("CustomEvent") customEvent.initCustomEvent("action", true, false, { component: "Card", action: action, index: index }) root.dispatchEvent(customEvent) } client function dismissCard(sourceEvent, root, customEvent) { dismissed = true root = sourceEvent.currentTarget.closest("[data-wrn-card]") if (!root) { return } customEvent = document.createEvent("CustomEvent") customEvent.initCustomEvent("dismiss", true, false, { component: "Card", title: title }) root.dispatchEvent(customEvent) } } view {
{#if items.length > 0}
{#each items as item, itemIndex}
{#if item.imageSrc || item.image}
{item.imageAlt || item.alt || ""}
{/if}
{#if item.title || item.label}

{item.title || item.label}

{/if} {#if item.subtitle}

{item.subtitle}

{/if} {#if item.description}

{item.description}

{/if} {#if item.actionLabel || item.href} {item.actionLabel || "Learn more"} {/if}
{/each}
{:else} {/if}
} }