import '../nui-heading/nui-heading.js'; import '../nui-paragraph/nui-paragraph.js'; import { html, nothing, type TemplateResult } from 'lit'; import type { NuiType } from '../../types/nui-type.js'; export interface NuiCardViewState { title: string; subtitle: string; cardClass: string; nuiType: NuiType; hasHeader: boolean; hasTitleSlot: boolean; hasSubtitleSlot: boolean; hasFooter: boolean; } export interface CardRenderHandlers { onHeaderSlotChange: (event: Event) => void; onTitleSlotChange: (event: Event) => void; onSubtitleSlotChange: (event: Event) => void; onFooterSlotChange: (event: Event) => void; } export function getCardClass(cardClass: string): string { return ['nui-card', cardClass].filter(Boolean).join(' '); } function shouldShowCaption(state: NuiCardViewState): boolean { return Boolean( state.title || state.subtitle || state.hasTitleSlot || state.hasSubtitleSlot, ); } export function renderCard( state: NuiCardViewState, handlers: CardRenderHandlers, ): TemplateResult { const showCaption = shouldShowCaption(state); return html`
${ state.title ? html` ` : nothing }
${ state.subtitle ? html` ` : nothing }
`; }