import { Box } from './Box'; import { Text } from './Text'; export interface CircularProgressProps { value: number; max?: number; size?: number; strokeWidth?: number; intent?: 'primary' | 'success' | 'warning' | 'critical' | 'telemetry'; showValue?: boolean; label?: string; color?: string; // Alias for intent } export const CircularProgress = ({ value, max = 100, size = 64, strokeWidth = 4, intent = 'primary', showValue = false, label, color: colorProp }: CircularProgressProps) => { const radius = (size - strokeWidth) / 2; const circumference = radius * 2 * Math.PI; const offset = circumference - (value / max) * circumference; const intentColorMap = { primary: 'var(--ui-color-intent-primary)', success: 'var(--ui-color-intent-success)', warning: 'var(--ui-color-intent-warning)', critical: 'var(--ui-color-intent-critical)', telemetry: 'var(--ui-color-intent-telemetry)', }; const color = colorProp || intentColorMap[intent]; return ( {showValue && ( {Math.round((value / max) * 100)}% )} {label && ( {label} )} ); };