'use client'; import type { ReactNode } from 'react'; import { cn } from '@djangocfg/ui-core/lib'; /** * SuggestedPrompts — chat empty-state "starter prompts" surface. * * The pattern every chat consumer wants: a small hero (optional), a * title + description (optional), and a row/grid of clickable prompts * that seed the composer. Pluggable enough to cover ChatGPT-style * card grids and cmdop-style flat chips with the same component. * * Typical wiring inside ` * { setValue(p.prompt); focus(); }} /> * }} />`. */ export type SuggestedPromptItem = { id: string; /** Displayed on the chip / card. */ label: string; /** Sent on click (often equal to `label`). */ prompt: string; /** Optional leading icon. */ icon?: ReactNode; /** Optional secondary line (rendered in `grid` layout, ignored by `chips`). */ description?: string; }; export type SuggestedPromptsLayout = 'chips' | 'grid'; export interface SuggestedPromptsProps { items: readonly SuggestedPromptItem[]; onPick: (item: SuggestedPromptItem) => void; /** Optional title above the chips. */ title?: ReactNode; /** Optional subtitle/description above the chips. */ description?: ReactNode; /** Optional hero element above the title (icon, logo, …). */ hero?: ReactNode; /** Layout — `chips` (flat rounded-full buttons, default) or `grid` (2-col cards). */ layout?: SuggestedPromptsLayout; /** Container className. */ className?: string; /** ARIA label for the region wrapper. Default `Suggested prompts`. */ ariaLabel?: string; /** Custom render override for one item (escape hatch). */ renderItem?: (item: SuggestedPromptItem, idx: number) => ReactNode; } export function SuggestedPrompts({ items, onPick, title, description, hero, layout = 'chips', className, ariaLabel = 'Suggested prompts', renderItem, }: SuggestedPromptsProps) { const hasHeader = hero != null || title != null || description != null; return (
{hasHeader ? (
{hero != null ? (
{hero}
) : null} {title != null ? (

{title}

) : null} {description != null ? (

{description}

) : null}
) : null} {layout === 'grid' ? (
{items.map((item, idx) => renderItem ? ( {renderItem(item, idx)} ) : ( ), )}
) : (
{items.map((item, idx) => renderItem ? ( {renderItem(item, idx)} ) : ( ), )}
)}
); } function Chip({ item, onPick, }: { item: SuggestedPromptItem; onPick: (item: SuggestedPromptItem) => void; }) { return ( ); } function GridCard({ item, onPick, }: { item: SuggestedPromptItem; onPick: (item: SuggestedPromptItem) => void; }) { return ( ); }