component Card { props { @event click = function @event action = function @event navigate = function @event dismiss = function @event load = function @event error = function title = "Card title" subtitle = "" description = "" header = "" footer = "" imageSrc = "" imageAlt = "" imagePosition = "top" actionLabel = "" actionHref = "" headerActions = [] navigation = [] activeNav = "" mobileNavigation = false alertTitle = "" alertDescription = "" empty = false emptyTitle = "No data to show" emptyIcon = "icon-[lucide--inbox]" items = [] size = "md" color = "primary" variant = "default" layout = "vertical" align = "left" hover = "none" scrollable = false maxHeight = "18rem" dismissible = false ariaLabel = "" class = "" } state visible = true state selectedNav = activeNav functions { function chooseNavigation(item, index) { previousValue = selectedNav selectedNav = item.value || item.label $emit("navigate", { value: selectedNav, previousValue: previousValue, item: item, index: index }) } function chooseMobileNavigation(sourceEvent) { previousValue = selectedNav selectedNav = sourceEvent.target.value $emit("navigate", { value: selectedNav, previousValue: previousValue }) } function chooseAction(action, index) { $emit("action", { action: action, index: index }) } function dismissCard(sourceEvent) { panel = sourceEvent.currentTarget.closest(".wire-next__card-panel") if (panel) { panel.setAttribute("hidden", "") } visible = false $emit("dismiss", { title: title }) } } view {
{#if items.length > 0}
{#each items as item}
{#if item.imageSrc}
{item.imageAlt || ''}
{/if}
{#if item.title}

{item.title}

{/if} {#if item.description}

{item.description}

{/if}
{#if item.footer}
{item.footer}
{/if}
{/each}
{:else if visible}
{#if imagePosition === "overlay" && imageSrc}
{imageAlt}
{#if title}

{title}

{/if} {#if subtitle}{subtitle}{/if} {#if description}

{description}

{/if} {#if footer}{footer}{/if}
{:else} {#if header || headerActions.length > 0 || dismissible}
{header} {#if headerActions.length > 0 || dismissible} {#each headerActions as action, index} {/each} {#if dismissible} {/if} {/if}
{/if} {#if navigation.length > 0} {/if} {#if imageSrc && imagePosition !== "bottom"}
{imageAlt}
{/if} {#if alertTitle || alertDescription} {/if}
{#if empty}
{emptyTitle}
{:else} {#if title}

{title}

{/if} {#if subtitle}{subtitle}{/if} {#if description}

{description}

{/if} {#if actionLabel} {actionLabel} {/if} {/if}
{#if footer}
{footer}
{/if} {#if imageSrc && imagePosition === "bottom"}
{imageAlt}
{/if} {/if}
{/if}
} }