import React from 'react'; import { clsx } from 'clsx'; export interface ProgressProps extends React.HTMLAttributes { value: number; max?: number; showLabel?: boolean; size?: 'sm' | 'md' | 'lg'; variant?: 'default' | 'success' | 'warning' | 'error'; animated?: boolean; } /** * Progress bar component */ export const Progress = React.forwardRef( ( { value, max = 100, showLabel = false, size = 'md', variant = 'default', animated = false, className, ...props }, ref ) => { const percentage = Math.min(Math.max((value / max) * 100, 0), 100); const sizeClasses = { sm: 'h-1', md: 'h-2', lg: 'h-3', }; const variantClasses = { default: 'bg-primary', success: 'bg-success', warning: 'bg-warning', error: 'bg-destructive', }; return (
{showLabel && (
Progress {Math.round(percentage)}%
)}
); } ); Progress.displayName = 'Progress';