import * as React from 'react' import * as ProgressPrimitive from '@radix-ui/react-progress' import { cn } from '@/lib/utils' export interface ProgressProps extends React.ComponentPropsWithoutRef { showValue?: boolean label?: string } const Progress = React.forwardRef< React.ElementRef, ProgressProps >(({ className, value = 0, showValue = true, label, ...props }, ref) => { const pct = Math.min(Math.max(value ?? 0, 0), 100) const filled = Math.round((pct / 100) * 20) const empty = 20 - filled const barText = '='.repeat(filled) + ' '.repeat(empty) return (
{label && ( {label} )} {/* Bracket-style visual */}
[ {barText} ] {showValue && ( {Math.round(pct)}% )}
{/* Accessible indicator (visually hidden, only for Radix a11y) */}
) }) Progress.displayName = ProgressPrimitive.Root.displayName export { Progress }