3.3 KiB
3.3 KiB
Dashboard Contract Hardening
- Status:
completed - Owner:
codex - Date:
2026-03-25
Goal
Harden the new dashboard-oriented component contracts so the Revenue Dashboard scene no longer
needs to bypass them for high-emphasis KPI cards or for custom chart header layouts.
Scope
- In scope:
- extend
MetricCardwith high-emphasis tones suitable for dark or hero KPI panels - add structured
MetricCardheader slots for leading and aside content - make the
Chartheader composable without breaking the current convenience props - refresh docs stories, tests, and the revenue dashboard consumer to use the stronger contracts
- extend
- Out of scope:
- introducing a full dashboard layout or navigation system
- expanding the chart surface beyond the existing cartesian trend pattern
- extracting new sparkline or sparkbar primitives in this slice
Constraints
- Preserve the current Material-inspired design direction in
DESIGN.md. - Keep the API additive and source-owned instead of replacing existing stories with one-off markup.
- Preserve the stable slot and
data-*review surface so tests and docs stay predictable. - Keep the current
title/description/value/valueChangechart props working while adding the more composable header path.
Affected Surfaces
docs/exec-planspackages/ui/src/components/metric-card.tsxpackages/ui/src/components/metric-card.variants.tspackages/ui/src/components/chart.tsxpackages/ui/src/components/chart.variants.tspackages/ui/src/index.tspackages/ui/src/components/*.test.tsxapps/docs/src/components/*.stories.tsxapps/docs/src/revenue-dashboard.stories.tsx
Plan
- Extend
MetricCardwithinverseandherovisual tones plus stableleadingandasideheader slots. - Refactor
Chartto accept a composed header while keeping the current prop-based header API as a convenience fallback. - Update stories and the revenue dashboard scene so the new contracts are exercised by real compositions instead of only isolated tests.
- Run focused component and docs validation, then record any residual issues.
Validation
pnpm --filter @ai-ui/ui test -- metric-card chartpnpm --filter @ai-ui/ui typecheckpnpm build:docs
Orchestration Task Sketch
T1: hardenMetricCardtone and header composition contractT2 -> T1: hardenChartheader composition contractT3 -> T2: refresh stories, revenue dashboard usage, and focused validation
Status Log
2026-03-25 20:36started the contract-hardening slice after reviewing the revenue dashboard and confirming thatSales GrowthandSales Impactstill rely on API workarounds rather than first-class component affordances2026-03-25 20:49extendedMetricCardwithinverseandherotones plusleadingandasideheader slots, then refactored the docs story and revenue dashboard consumer to use them2026-03-25 20:56refactoredChartto support a composed header path while preserving the legacy prop-driven header contract, and updated stories and tests to cover both paths2026-03-25 20:59validated focusedMetricCardandCharttests plusbuild:docs;pnpm --filter @ai-ui/ui typecheckis still blocked by unrelated pre-existingpackages/ui/src/components/sparkbar.tsxtype errors outside this slice