import { useState } from 'react'; import type { ReactNode } from 'react'; export function StatusPill({ status }: { status: 'LIVE' | 'GATED' | 'APPROVED' | 'ROADMAP' | 'WARN' | 'ERROR' | 'CONNECTING' }) { const styles: Record = { LIVE: { bg: 'rgba(201,183,135,0.15)', color: '#c9b787' }, GATED: { bg: 'rgba(94,94,94,0.15)', color: '#5e5e5e' }, APPROVED: { bg: 'rgba(201,183,135,0.15)', color: '#c9b787' }, ROADMAP: { bg: 'rgba(94,94,94,0.15)', color: '#5e5e5e' }, WARN: { bg: 'rgba(201,183,135,0.15)', color: '#c9b787' }, ERROR: { bg: 'rgba(245,245,245,0.12)', color: '#f5f5f5' }, CONNECTING: { bg: 'rgba(94,94,94,0.15)', color: '#5e5e5e' }, }; const s = styles[status] ?? styles.LIVE; return ( {status === 'LIVE' && } {status} ); } export function ApprovalGate({ label = 'Requires human approval', onApprove, onReject, }: { label?: string; onApprove?: () => void; onReject?: () => void; }) { return (
{label}
{(onApprove || onReject) && (
{onApprove && ( )} {onReject && ( )}
)}
); } export function PageHeader({ label, title, subtitle, status, children, }: { label: string; title: string; subtitle?: string; status?: 'LIVE' | 'GATED' | 'APPROVED' | 'ROADMAP' | 'WARN' | 'ERROR' | 'CONNECTING'; children?: ReactNode; }) { return (
{label} {status && } Governed Environment

{title}

{subtitle && (

{subtitle}

)}
{children}
); } export function Card({ children, className = '', onClick, style }: { children: ReactNode; className?: string; onClick?: () => void; style?: React.CSSProperties }) { return (
{children}
); } export function SectionTitle({ children, className = '' }: { children: ReactNode; className?: string }) { return (

{children}

); } export function KpiCard({ label, value, sub, accent, trend }: { label: string; value: string | number; sub?: string; accent?: string; trend?: 'up' | 'down' | 'neutral' }) { return (
{label}
{value}
{trend && ( {trend === 'up' ? '↑' : trend === 'down' ? '↓' : '→'} )}
{sub &&
{sub}
}
); } export function SeverityDot({ severity }: { severity: 'critical' | 'high' | 'medium' | 'low' | 'info' }) { const colors: Record = { critical: '#f5f5f5', high: '#c9b787', medium: '#8a8a8a', low: '#5e5e5e', info: '#5e5e5e', }; return ( ); } export function SeverityBadge({ severity }: { severity: string }) { const styles: Record = { critical: { bg: 'rgba(245,245,245,0.10)', color: '#f5f5f5' }, high: { bg: 'rgba(201,183,135,0.12)', color: '#c9b787' }, medium: { bg: 'rgba(138,138,138,0.10)', color: '#8a8a8a' }, low: { bg: 'rgba(94,94,94,0.10)', color: '#5e5e5e' }, info: { bg: 'rgba(94,94,94,0.10)', color: '#5e5e5e' }, active: { bg: 'rgba(201,183,135,0.12)', color: '#c9b787' }, escalated: { bg: 'rgba(245,245,245,0.10)', color: '#f5f5f5' }, acknowledged: { bg: 'rgba(138,138,138,0.10)', color: '#8a8a8a' }, resolved: { bg: 'rgba(94,94,94,0.10)', color: '#5e5e5e' }, suppressed: { bg: 'rgba(94,94,94,0.08)', color: '#5e5e5e' }, }; const s = styles[severity] ?? styles.info; return ( {severity.toUpperCase()} ); } export function VerdictBadge({ verdict }: { verdict: 'pass' | 'fail' | 'warn' | 'abstain' }) { const styles: Record = { pass: { bg: 'rgba(201,183,135,0.12)', color: '#c9b787', icon: '✓' }, fail: { bg: 'rgba(245,245,245,0.10)', color: '#f5f5f5', icon: '✗' }, warn: { bg: 'rgba(138,138,138,0.12)', color: '#8a8a8a', icon: '⚠' }, abstain: { bg: 'rgba(94,94,94,0.12)', color: '#5e5e5e', icon: '—' }, }; const s = styles[verdict] ?? styles.abstain; return ( {s.icon} {verdict.toUpperCase()} ); } export function HashId({ id }: { id: string }) { return ( {id} ); } export function ActionButton({ children, variant = 'primary', disabled, onClick, size = 'md', }: { children: ReactNode; variant?: 'primary' | 'ghost' | 'danger' | 'warn'; disabled?: boolean; onClick?: () => void; size?: 'sm' | 'md'; }) { const styles: Record = { primary: { bg: '#c9b787', color: '#0a0a0a', border: 'transparent' }, ghost: { bg: 'transparent', color: 'var(--color-a11oy-text-sub)', border: 'var(--color-a11oy-border)' }, danger: { bg: 'rgba(245,245,245,0.08)', color: '#f5f5f5', border: 'rgba(245,245,245,0.15)' }, warn: { bg: 'rgba(201,183,135,0.1)', color: '#c9b787', border: 'rgba(201,183,135,0.25)' }, }; const s = styles[variant]; const pad = size === 'sm' ? 'px-2 py-1' : 'px-3 py-1.5'; return ( ); } export function VerticalBadge({ vertical, color }: { vertical: string; color: string }) { return ( {vertical} ); } export function StatusBadge({ status, label }: { status: 'ok' | 'warn' | 'error' | 'info'; label: string }) { const colors = { ok: '#c9b787', warn: '#8a8a8a', error: '#f5f5f5', info: '#5e5e5e', }; const color = colors[status]; return ( {label} ); } export function CodeBlock({ children, language = 'json' }: { children: string; language?: string }) { const [copied, setCopied] = useState(false); const copy = () => { navigator.clipboard.writeText(children).then(() => { setCopied(true); setTimeout(() => setCopied(false), 1500); }); }; return (
{language}
        {children}
      
); } export function TraceStep({ step, status, note, }: { step: string; status: 'completed' | 'running' | 'pending' | 'failed' | 'skipped' | string; note?: string; }) { const statusColor = status === 'completed' || status === 'ok' ? '#c9b787' : status === 'running' ? '#c9b787' : status === 'failed' || status === 'error' ? '#f5f5f5' : status === 'skipped' ? '#5e5e5e' : '#5e5e5e'; const statusIcon = status === 'completed' || status === 'ok' ? '✓' : status === 'running' ? '⟳' : status === 'failed' || status === 'error' ? '✗' : status === 'skipped' ? '—' : '○'; return (
{statusIcon}
{step}
{note &&
{note}
}
{status}
); } export function ProgressBar({ value, max = 100, color = '#c9b787' }: { value: number; max?: number; color?: string }) { const pct = Math.min(100, Math.round((value / max) * 100)); return (
); } export function EmptyState({ title, description, icon = '⬡' }: { title: string; description?: string; icon?: string }) { return (
{icon}
{title}
{description &&
{description}
}
); } export function InfoRow({ label, value, mono = false }: { label: string; value: ReactNode; mono?: boolean }) { return (
{label} {value}
); }