import type { IntentName } from "@charcuterie/tokens" import type { ReactNode } from "react" import { Card, type CardProps } from "../Card/Card.tsx" import { INTENT_APPEARANCE_CLASS } from "../intentStyles.ts" import { ProgressBar } from "../ProgressBar/ProgressBar.tsx" import { toClassName } from "../toClassName.ts" export type ProgressCardMetric = { label: string value: ReactNode } export type ProgressCardLayout = "band" | "hierarchy" export type ProgressCardProps = Omit< CardProps, "heading" | "footer" > & { "aria-label": string /** App-owned identity: a title, an identifier, or a format mark. */ header: ReactNode /** Whole-card intent is independent of the progress fill. */ intent?: IntentName isIndeterminate?: boolean isValueEmphasized?: boolean layout?: ProgressCardLayout max?: number media?: ReactNode metrics?: readonly ProgressCardMetric[] progressIntent?: IntentName progressLabel: string status?: string value?: number /** App-formatted percentage or terminal state; never inferred from intent. */ valueText: string } /** A progress-first card. The app owns state, formatting, actions, and diagnosis. */ export const ProgressCard = ({ actions, children, className, header, intent = "neutral", isIndeterminate = false, isValueEmphasized = true, layout = "band", max, media, metrics = [], progressIntent = "accent", progressLabel, status, value, valueText, ...cardProps }: ProgressCardProps): ReactNode => { const headline = (