import type { CSSProperties } from 'react'; import { cn } from '../../lib/cn'; export interface ConfidenceRingProps { /** Confidence 0–1. */ value?: number; /** Diameter in px. @default 72 */ size?: number; stroke?: number; showLabel?: boolean; /** Autonomy threshold. @default 0.7 */ threshold?: number; className?: string; style?: CSSProperties; } /** * Confidence ring (0–1). ≥0.70 emerald "Autonomous", <0.70 amber "Escalated". * The signature trust signal across Aria's AI Decision Cards. */ export function ConfidenceRing({ value = 0, size = 72, stroke = 7, showLabel = true, threshold = 0.7, className, style, }: ConfidenceRingProps) { const v = Math.max(0, Math.min(1, value)); const autonomous = v >= threshold; const color = autonomous ? 'var(--status-autonomous)' : 'var(--status-escalated)'; const r = (size - stroke) / 2; const circ = 2 * Math.PI * r; const dash = circ * v; const pct = Math.round(v * 100); return (
{pct} %
{showLabel && ( {autonomous ? 'Autonomous' : 'Escalated'} )}
); }